본문 바로가기

Javascript

document 객체.html

       

아래에 화면결과 있어요.

 

 

아래에 코드 있어요

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html lang="en">
<head id = "Myhead">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>document 객체 주요 요소값</title>
    <script>
        var text = "문서 로딩 중일 때 readyState = " + document.readyState + "\n";
    </script>
</head>
<body onload="printProperties()" style="background-color: yellow; color: blue; direction: rtl;"> <!--바디태그 처음으로 이벤트속성-->
    <a href ="http://naver.com">네이버</a>
    <div>이곳은 div 영역입니다.</div>
    <input id="input" value="여기 포커스가 있습니다.">
    <script>
        function printProperties() {
            document.getElementById("input").focus();
            text+="1.location = "+ document.location + "\n";//많이 사용
            text+="2.URL = "+ document.URL + "\n";
            text+="3.title = "+ document.title + "\n"//동적으로 할 때 사용
            text+="4.head.id= "+ document.head.id + "\n";
            text+="5.body.color = "+ document.body.style.color + "\n";
            text+="6.domain = "+ document.domain + "\n";
            text+="7.lastModified = "+ document.lastModified + "\n"//이 파일 마지막으로 수정된 날짜 값을 리턴해주는 변수
            text+="8.defaultView = "+ document.defaultView + "\n";
            text+="9.문서의 로드 완료 후 readyState = "+ document.readyState + "\n";
            text+="9.documentElement의 태그이름 = "+ document.documentElement.tagName + "\n";
            
            alert(text);
        }
    </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

'Javascript' 카테고리의 다른 글

write().html  (0) 2020.03.17
DOM 트리에서 DOM 객체 찾기.html  (0) 2020.03.17
this  (0) 2020.03.12
innerHTML  (0) 2020.03.11
CSS 동적변경  (0) 2020.03.11