日期:2014-05-17 浏览次数:20767 次
<html>
<head> </head>
<script>
function showDiv() {
var obj = document.getElementById("myDiv");
obj.style.display = '';
obj.style.width = "100%";
obj.style.height = "100%";
var height = obj.style.pixelHeight;
var width = obj.style.pixelWidth;
alert(height + "," + width);
}
</script>
<body onload ="showDiv()">
<input type="button" onclick="showDiv()" value="显示DIV" style="position:absolute;left:5px;top:5px; z-index:2;" />
<div id="myDiv" style="position: absolute; display:none;background-color:silver;left:0px;top:0px">123 </div>
</body>
</html>