JavaScript / Object / document.write()
.write()
.write()은 문서에 문자, 코드 등을 쓰는 메서드입니다.
문법
document.write( exp1, exp2, ... )
예제
- Hello와 World를 연달아 출력합니다.
document.write( 'Hello', 'World' );
- 2를 출력합니다.
document.write( 1+1 )
- 코드는 코드로 인식합니다.
document.write( '<p style="font-size: 80px; text-align: center;">Hello</p>' );
- 닫는 script 태그에는 \를 붙여서 <\/script>로 씁니다.
document.write( '<script>document.write( "Hello" )<\/script>' );