日期:2014-05-17  浏览次数:20601 次

同一个调整div尺寸的方法,执行两次,结果不一样
HTML code

<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> 





------解决方案--------------------
执行了没什么不一样啊
------解决方案--------------------
我使用ie8两事件的数据显示也是一样的啊