为什么不能读取当前浏览器高度呢?
javascript吧
全部回复
仅看楼主
level 8
jy03692141 楼主
document.write(document.body.clientHeight);
完全读不来啊
document.write(document.body.clientWidth);
但是读高的话就毫无压力啊
2012年05月01日 12点05分 1
level 8
jy03692141 楼主
不是 document.write(document.body.clientWidth);
读宽没问题,但是换成Height就读不了高
2012年05月01日 12点05分 2
level 11
2012年05月01日 12点05分 3
level 8
jy03692141 楼主
我晕啊 可是HTML里输出就没反映啊
2012年05月01日 13点05分 4
level 11
lz
用的ie么?
记得ie加doctype时要用 document.rootElement 好像,
记不清了
[揉脸]
2012年05月01日 13点05分 5
level 8
jy03692141 楼主
是IE啊。可是读取宽就可以 见鬼了额
2012年05月01日 13点05分 6
level 11
不是没解析完吧,扔window.onload里面试试
2012年05月01日 13点05分 7
level 6
读出来了啊。怎么读不出来。我这里怎么是好的。
2012年05月03日 09点05分 8
level 10
也可能和html标准有关
2012年05月03日 09点05分 9
level 8
页面可视高度,不包括滚动部分:
window.innerHeight (低于ie 9不支持)
firefox、chrome 下 html.clientHeight、html.offsetHeight
IE 怪异模式下, html.clientHeight 为0,可用html.offsetHeight(html.clientHeight为0) 或 body.clientHieght
IE 非怪异模式下 html.clientHeight(body.clientHeight 为页面高度)
有 dtd:
IE下 body.clientHeigth 为页面高度, html.clientHeight 为页面可视高度(怪异模式html.clientHeight为0,请用 html.offsetHeight 代替 )
firefox、chrome 下 body.clientHeight 为页面高度, html.clientHeight 为页面可视高度
无 dtd:
IE下 body.clientHeight 仍为页面高度, html.clientHeight 为页面可视高度
firefox、chrome 下 html.clientHeight 为页面高度, body.clientHeight 为页面可视高度

2012年05月03日 14点05分 10
level 8
因此:
window.innerHeight||document.documentElement.offsetHeight||document.body.clientHieght
2012年05月03日 14点05分 11
1