為什么這三種寫法得到的答案不同
<!DOCTYPE HTML>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">?
</head>
<body>
?<script type="text/javascript">
var w=document.documentElement.offsetWidth;
var h=document.documentElement.offsetHeight;
document.write(w+"***"+h+"<br>");
document.write(document.body.offsetWidth+"<br>");
document.write(document.body.offsetHeight+"<br>");
var x = document.documentElement.offsetWidth ? ?|| document.body.offsetWidth;
var y= document.documentElement.offsetHeight ? ?|| document.body.offsetHeight;
document.write("寬度:" + x);
document.write("<br>高度:" + y);
</script>
</body>
</html>
2016-02-23
瀏覽器的兼容性問題