1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
<head>
4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
<title>http://www.zishu.cn</title>
6
<style>
7
*{ margin:0; padding:0}
8
#info{background:#33CCFF}
9
#bottom{background:#FFCC00;width:100%;}
10
</style>
11
</head>
12
<body>
13
<div id="info">
14
<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br /><br />2<br />20000</div>
15
<div id="bottom">bottom</div>
16
17
<script language="JavaScript" type="text/javascript">
18
function test(){
19
var infoHeight = document.getElementById("info").scrollHeight;
20
var bottomHeight = document.getElementById("bottom").scrollHeight;
21
var allHeight = document.documentElement.clientHeight;
22
23
var bottom = document.getElementById("bottom");
24
if((infoHeight + bottomHeight) < allHeight){
25
bottom.style.position = "absolute";
26
bottom.style.bottom = "0";
27
}else{
28
bottom.style.position = "";
29
bottom.style.bottom = "";
30
}
31
32
setTimeout(function(){test();},10);
33
}
34
test();
35
</script>
36
</body>
37
</html>
38
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2
<html xmlns="http://www.w3.org/1999/xhtml"> 3
<head> 4
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5
<title>http://www.zishu.cn</title> 6
<style> 7
*{ margin:0; padding:0} 8
#info{background:#33CCFF} 9
#bottom{background:#FFCC00;width:100%;} 10
</style> 11
</head> 12
<body> 13
<div id="info"> 14
<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br /><br />2<br />20000</div> 15
<div id="bottom">bottom</div> 16
17
<script language="JavaScript" type="text/javascript"> 18
function test(){ 19
var infoHeight = document.getElementById("info").scrollHeight; 20
var bottomHeight = document.getElementById("bottom").scrollHeight; 21
var allHeight = document.documentElement.clientHeight; 22
23
var bottom = document.getElementById("bottom"); 24
if((infoHeight + bottomHeight) < allHeight){ 25
bottom.style.position = "absolute"; 26
bottom.style.bottom = "0"; 27
}else{ 28
bottom.style.position = ""; 29
bottom.style.bottom = ""; 30
} 31
32
setTimeout(function(){test();},10); 33
} 34
test(); 35
</script> 36
</body> 37
</html> 38



*
浙公网安备 33010602011771号