File tree Expand file tree Collapse file tree 7 files changed +138
-0
lines changed Expand file tree Collapse file tree 7 files changed +138
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Window对象</ title >
6
+ </ head >
7
+ < body >
8
+ < p id ="demo "> </ p >
9
+ < script >
10
+ var w = window . innerWidth || document . documentElement . clientWidth || document . body . clientWidth ;
11
+ var h = window . innerHeight || document . documentElement . clientHeight || document . body . clientHeight ;
12
+
13
+ x = document . getElementById ( 'demo' ) ;
14
+ x . innerHTML = '浏览器内部的窗口宽度:' + w + ",高度:" + h + " . " ;
15
+ </ script >
16
+
17
+ </ body >
18
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Title</ title >
6
+ </ head >
7
+ < body >
8
+ < script >
9
+ document . write ( "可用宽度:" + screen . availWidth ) ;
10
+
11
+ document . write ( "可用高度:" + screen . availHeight ) ;
12
+
13
+
14
+ </ script >
15
+
16
+
17
+ </ body >
18
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Title</ title >
6
+ < script >
7
+ function newDoc ( ) {
8
+ window . location . assign ( "http://www.w3school.com.cn" ) ;
9
+ }
10
+ </ script >
11
+
12
+
13
+ </ head >
14
+ < body >
15
+ < script >
16
+ document . write ( location . href ) ;
17
+ document . write ( "<br/>" ) ;
18
+ document . write ( location . pathname ) ;
19
+ </ script >
20
+ < br />
21
+ < input type ="button " onclick ="newDoc() " value ="加载新文档 ">
22
+
23
+ </ body >
24
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Title</ title >
6
+ < script >
7
+ function goBack ( ) {
8
+ window . history . back ( ) ;
9
+ }
10
+ </ script >
11
+ < script >
12
+ function goForward ( ) {
13
+ window . history . forward ( ) ;
14
+ }
15
+ </ script >
16
+
17
+ </ head >
18
+ < body >
19
+ < input type ="button " value ="goBack " onclick ="goBack() "/>
20
+ < br />
21
+ < input type ="button " value ="Forward " onclick ="goForward() "/>
22
+
23
+ </ body >
24
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Title</ title >
6
+ </ head >
7
+ < body >
8
+ < div id ="example "> </ div >
9
+ < script >
10
+ txt = "<p> Browser CodeName:" + navigator . appCodeName + "</p>" ;
11
+ txt += "<p> Browser Name:" + navigator . appName + "</p>" ;
12
+ txt += "<p> Browser Version:" + navigator . appVersion + "</p>" ;
13
+ txt += "<p> Cookies Enabled:" + navigator . cookieEnabled + "</p>" ;
14
+ txt += "<p>User-agent header:" + navigator . userAgent + "</p>" ;
15
+ txt += "<p> >User-agent language:" + navigator . systemLanguage + "</p>" ;
16
+ document . getElementById ( "example" ) . innerHTML = txt ;
17
+
18
+ </ script >
19
+
20
+
21
+ </ body >
22
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Title</ title >
6
+ </ head >
7
+ < body >
8
+ < script >
9
+ alert ( "文本框!" ) ;
10
+ confirm ( "文本框!" ) ;
11
+
12
+ </ script >
13
+
14
+
15
+ </ body >
16
+ </ html >
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < meta charset ="UTF-8 ">
5
+ < title > Title</ title >
6
+ </ head >
7
+ < body >
8
+ < script >
9
+ function timedMsg ( ) {
10
+ var t = setTimeout ( "alert('5 seconds!')" , 5000 ) ;
11
+ }
12
+
13
+ </ script >
14
+ < input type ="button " value ="Display timed alertbox! " onclick ="timedMsg() "/>
15
+ </ body >
16
+ </ html >
You can’t perform that action at this time.
0 commit comments