-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.html
34 lines (34 loc) · 928 Bytes
/
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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
<style>
body{
margin:0;
padding:0;
}
</style>
</head>
<body>
<div id="test" style=" background:#999;"></div>
</body>
</html>
<script type="text/javascript">
autoheight();
function autoheight(){
var winHeight=0;
if (window.innerHeight)
winHeight = window.innerHeight;
else if ((document.body) && (document.body.clientHeight))
winHeight = document.body.clientHeight;
if (document.documentElement && document.documentElement.clientHeight)
winHeight = document.documentElement.clientHeight;
document.getElementById("test").style.height= winHeight +"px";
}
window.onresize=autoheight; //浏览器窗口发生变化时同时变化DIV高度
</script>