forked from lzhanforgit/Web-HTML5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
95 lines (83 loc) · 3.11 KB
/
test.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="div01" name="div_01">
2222
</div>
<ul><li name="li_00">l1</li><li>l2</li><li id="li03">l3</li><li>l4</li></ul>
<div name="div_02">222</div>
<div name="div_03">333</div>
<div name="div_04">444</div>
<div id="div05" data-user-name="lzhan"></div>
<script>
window.onload=function () {
// var p=document.getElementsByTagName('p')[0];
// var parent=p.parentNode.nodeName;
// console.log(parent);
//
// var h1=document.getElementsByTagName('h1')[0];
// var parent_h1=h1.parentNode.nodeName;
// console.log(parent_h1);
// var pre_node=h1.previousElementSibling;
// var next_node=h1.nextElementSibling;
// console.log(pre_node);
// console.log(next_node);
// var div01=document.getElementById('div01');
// var first_node=div01.firstChild;
// var last_node=div01.lastChild;
// console.log(first_node);
// console.log(last_node);
// var ul=document.getElementsByTagName('ul')[0];
// var li=document.createElement('li');
// li.setAttribute('id','001');
// var txt=document.createTextNode('-haha-');
// li.appendChild(txt);
//
// var li03=document.getElementById('li03');
// var f=ul.removeChild(ul.firstChild.nextSibling);
// console.log(f);
//
// var uull=ul.cloneNode(true);
// document.body.appendChild(uull);
//
// ul.removeChild(ul.firstChild);
// document.title='hello js';
// console.log("..."+document.URL);
// console.log("..."+document.domain);
// console.log("..."+document.referrer);
// var divs=document.getElementsByTagName('div')[0];
// var con1=divs[0].firstChild;
// console.log(con1);
// var con2=divs['div_01'].firstChild;
// console.log(con2);
//
// var nodes=document.getElementsByTagName('ul')[0];
// console.log(nodes.firstChild);
// console.log(nodes.childNodes.length);
// var f=document.implementation.hasFeature('xml','1.0');
// var f=document.implementation.hasFeature('css2','2.0');
// var script=document.createElement('script');
// script.type='text/javascript';
// var code="function show(){alert('hello');}";
// try{
// script.appendChild(document.createTextNode(code));
// }catch(e){
// script.text=code;
// }
// document.body.appendChild(script);
// show();
var link=document.createElement('link');
link.rel='stylesheet';
link.type="text/css";
link.href="css/main.css";
var head=document.getElementsByTagName('head')[0];
head.appendChild(link);
}
</script>
<!--<script type="text/javascript" src="js/main.js"></script>-->
</body>
</html>