본문 바로가기

Javascript

자바스크립트로 HTML 콘텐츠 출력

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ex2.html document 활용</title>
</head>
<body>
    <h3>document 활용</h3><hr>
    <a href ="http://naver.com">네이버</a>
    <script>
        //객체 document 는 웹페이지 그 자체
        document.write("<h3>Welcome!</h3>");
        document.write("2+3=<br>");
        document.write("<mark>7입니다.</mark><br>");
        t=document.title;
        document.write(t);
        a = document.anchors.length;
        document.write(a);
    </script>
</body>
</html>
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none;color:white">cs