是当前页面?还是其它页面?
当前页面
document.documentElement.offsetWidth;
document.documentElement.offsetHeight;
其它页面
window.frames["frameName"].document.documentElement.offsetWidth;
当前页面
document.documentElement.offsetWidth;
document.documentElement.offsetHeight;
其它页面
window.frames["frameName"].document.documentElement.offsetWidth;
谢谢了
iWidth=document.body.clientHeight;
iHeight=document.body.clientWidth;
本来我想用这个得到本窗口的宽度和高度,可是得到的值却为height:0 width:200
好象body并没有扩满窗口
所以我只好用他所在的框架来得到窗口的高度和宽度
该如何得到呢?
function initBody()
{
alert("height:"+document.body.scrollHeight+" width:"+document.body.clientWidth);
}
</script>
</head><body leftmargin="10" topmargin="0" onLoad="initBody()">
<script>
function initBody()
{
alert("height:"+document.body.scrollHeight+" width:"+document.body.clientWidth);
}
</script>
</head><body leftmargin="10" topmargin="0" onLoad="initBody()">
我已经解决了
需要在body里设置好他的长和宽为百分百
<body rightmargin="10" style="width:100%;height:100%; " topmargin="0" >