标签:bsp body 方法 cli script tle back idt function
方法1:
<html> <head> <title></title> <script language="javascript" type="text/javascript"> window.onload = function() { var div = document.getElementById("csdn"); div.style.position = "absolute"; div.style.top = "0"; div.style.height = document.documentElement.clientHeight; } </script> </head> <body> <div id="csdn" style="background-color: #FF0000; width: 200px;"> 1234567890-=<br /> 1234567890-=<br /> </div> </body> </html>
2. 方法2
方法1在有些场合还是无法解决问题,
var height = document.documentElement.scrollHeight; if (height > 30) { height = height - 30; $("body").css(‘height‘, height); } }
这里使用了 document.documentElement.scrollHeight
标签:bsp body 方法 cli script tle back idt function
原文地址:https://www.cnblogs.com/digdeep/p/12585112.html