doctype后如何获得body.clientHeight的方法
岁数大了,QQ也不闪了,微信也不响了,电话也不来了,但是图老师依旧坚持为大家推荐最精彩的内容,下面为大家精心准备的doctype后如何获得body.clientHeight的方法,希望大家看完后能赶快学习起来。
因为在加了doctype后,在ie6中这些document.body的属性已经重新分配给了document.documentElement。
比如:原来document.body.clientHeight,就要改成document.documentElement.scrollTop
为了自适应,可以改了下代码:
((document.documentElement.clientHeight==0)?document.body.clientHeight:document.documentElement.clientHeight)
用这样的代码就能自适应了。



