document.viewport.getHeight()返回为0

来源:互联网 发布:淘宝 评价 期限 编辑:程序博客网 时间:2024/06/05 09:00
 

document.viewport.getHeight()返回为0

使用prototype的document.viewport.getHeight()始终返回为0,不解。终于在一个国外的论坛上找到一个答案:
Turns out you need a correct DOCTYPE to make it work properly, otherwise Prototype will be in "quirks mode" which doesn't let getheight() work as intended.

Problem solved, then. Now time to wait 48 hours >_>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
原创粉丝点击