现在的位置: 首页 > 综合 > 正文

document.viewport.getHeight()返回为0

2013年06月02日 ⁄ 综合 ⁄ 共 446字 ⁄ 字号 评论关闭
 

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">

抱歉!评论已关闭.