Skip to content

Commit 433cd0d

Browse files
committed
BOM应用
1 parent 00b1f28 commit 433cd0d

File tree

70 files changed

+720
-1213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+720
-1213
lines changed

BOM/close.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<input type="button" value="close" onclick="window.close();"/>
11+
</body>
12+
</html>

BOM/confirm.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script>
9+
var res=confirm('你是否要删除?');
10+
11+
alert(res);
12+
</script>
13+
</head>
14+
<body>
15+
16+
</body>
17+
</html>

BOM/document.write.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<input type="button" value="write" onclick="document.write('abc')"/>
11+
</body>
12+
</html>

BOM/location.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script>
9+
alert(window.location);
10+
</script>
11+
</head>
12+
<body>
13+
<input type="button" value="aaa" onclick="window.location='http://www.baidu.com/';"
14+
</body>
15+
</html>

BOM/open.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<input type="button" value="打开窗口" onclick="window.open('http://baidu.com/');"/>
11+
</body>
12+
</html>

BOM/open_close.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
</head>
9+
<body>
10+
<input type="button" value="open" onclick="window.open('close.html');"/>
11+
</body>
12+
</html>

BOM/prompt.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script>
9+
prompt('请输入你的姓名:','blue');
10+
</script>
11+
</head>
12+
<body>
13+
14+
</body>
15+
</html>

BOM/scrollTop.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script>
9+
document.onclick=function()
10+
{
11+
//IE/FF
12+
//alert(document.documentElement.scrollTop);
13+
14+
//chrome
15+
//alert(document.body.scrollTop);
16+
17+
var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
18+
19+
alert(scrollTop);
20+
21+
};
22+
</script>
23+
</head>
24+
<body style="height:2000px;">
25+
26+
</body>
27+
</html>

BOM/userAgent.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script>
9+
alert(window.navigator.userAgent);
10+
</script>
11+
</head>
12+
<body>
13+
14+
</body>
15+
</html>

BOM/可视区.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script>
9+
window.onload=function()
10+
{
11+
var oBtn=document.getElementById('btn1');
12+
13+
oBtn.onclick=function()
14+
{
15+
alert('宽:'+document.documentElement.clientWidth+'高:'+document.documentElement.clientHeight);
16+
}
17+
18+
};
19+
</script>
20+
</head>
21+
<body>
22+
<input id="btn1" type="button" value="可视区大小" />
23+
</body>
24+
</html>

BOM/右下角悬浮框.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<style>
9+
#div1{
10+
width: 200px;
11+
height: 150px;
12+
background: red;
13+
position: absolute;
14+
right:0;
15+
bottom: 0;
16+
}
17+
body{
18+
height: 2000px;
19+
}
20+
</style>
21+
<script>
22+
window.onscroll=function()
23+
{
24+
var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
25+
26+
var oDiv=document.getElementById('div1');
27+
28+
oDiv.style.top=document.documentElement.clientHeight-oDiv.offsetHeight+scrollTop+'px';
29+
30+
};
31+
</script>
32+
</head>
33+
<body>
34+
<div id="div1"></div>
35+
</body>
36+
</html>

BOM/右下角悬浮框2.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<style>
9+
#div1{
10+
width: 200px;
11+
height: 150px;
12+
background: red;
13+
position: absolute;
14+
right:0;
15+
bottom: 0;
16+
}
17+
body{
18+
height: 2000px;
19+
}
20+
</style>
21+
<script>
22+
window.onscroll=window.onresize=function()
23+
{
24+
var scrollTop=document.documentElement.scrollTop||document.body.scrollTop;
25+
26+
var oDiv=document.getElementById('div1');
27+
28+
oDiv.style.top=document.documentElement.clientHeight-oDiv.offsetHeight+scrollTop+'px';
29+
30+
};
31+
</script>
32+
</head>
33+
<body>
34+
<div id="div1"></div>
35+
</body>
36+
</html>

BOM/固定定位.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<style>
9+
#div1{
10+
width: 200px;
11+
height: 150px;
12+
background: red;
13+
position: fixed;
14+
right:0;
15+
bottom: 0;
16+
}
17+
body{
18+
height: 2000px;
19+
}
20+
</style>
21+
</head>
22+
<body>
23+
<div id="div1"></div>
24+
</body>
25+
</html>

BOM/运行.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
7+
<title>Document</title>
8+
<script>
9+
window.onload=function()
10+
{
11+
var oTxt=document.getElementById('txt1');
12+
var oBtn=document.getElementById('btn1');
13+
14+
oBtn.onclick=function()
15+
{
16+
var oNewWin=window.open('about:blank','_blank');
17+
18+
oNewWin.document.write(oTxt.value);
19+
20+
};
21+
}
22+
</script>
23+
</head>
24+
<body>
25+
<textarea id="txt1" rows="10" cols="40"></textarea><br>
26+
<input id="btn1" type="button" value="运行"/>
27+
</body>
28+
</html>

JavaScript系列视频资料/智能社视频材料 - JS面向对象高级/记录/引用.html renamed to JavaScript系列视频资料/智能社视频材料 - COOKIE基础与应用/记录/Date.html

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
<meta charset="utf-8">
55
<title>无标题文档</title>
66
<script>
7-
var arr1=[1,2,3];
8-
var arr2=arr1;
7+
var oDate=new Date();
98

10-
arr2.push(4);
9+
oDate.setDate(32);
1110

12-
alert(arr1); //1,2,3
13-
alert(arr2); //1,2,3,4
11+
alert(oDate.getFullYear()+'-'+(oDate.getMonth()+1)+'-'+oDate.getDate());
1412
</script>
1513
</head>
1614

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>无标题文档</title>
6+
<script>
7+
var oDate=new Date();
8+
9+
oDate.setDate(oDate.getDate()+800000);
10+
11+
alert(oDate.getFullYear()+'-'+(oDate.getMonth()+1)+'-'+oDate.getDate());
12+
</script>
13+
</head>
14+
15+
<body>
16+
</body>
17+
</html>
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44
<meta charset="utf-8">
55
<title>无标题文档</title>
66
<script>
7-
function show()
8-
{
9-
alert(this);
10-
}
7+
document.cookie='user=blue'; //添加
8+
document.cookie='pass=123456';
119

12-
show(); //window
13-
new show(); //新new出来的对象
10+
alert(document.cookie);
1411
</script>
1512
</head>
1613

JavaScript系列视频资料/智能社视频材料 - JS面向对象基础/记录/this.html renamed to JavaScript系列视频资料/智能社视频材料 - COOKIE基础与应用/记录/cookie过期时间.html

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,13 @@
44
<meta charset="utf-8">
55
<title>无标题文档</title>
66
<script>
7-
var arr=[1,2,3,4];
7+
var oDate=new Date();
88

9-
arr.a=12;
9+
oDate.setDate(oDate.getDate()+14);
1010

11-
arr.show=function ()
12-
{
13-
alert(this.a);
14-
};
11+
document.cookie='user=blue;expires='+oDate;
1512

16-
oDiv.onclick=function ()
17-
{
18-
alert(this);
19-
};
20-
21-
arr.show();
13+
alert(document.cookie);
2214
</script>
2315
</head>
2416

0 commit comments

Comments
 (0)