IE11 javascript window.outerWidth返回undefined

时间:2017-03-17 21:13:23

标签: javascript window hta outerheight outerwidth

谷歌搜索说window.outerWidth和window.outerHeight将返回当前窗口的外部尺寸。但是,我在IE11中打开的HTA文件为这些属性提供了“undefined”。我做错了什么?

<!DOCTYPE html>
<HTML>
<HEAD>
<TITLE>Size Test</TITLE>
<SCRIPT type="text/javascript">
    function ShowSize() {
        window.alert("W = " + window.outerWidth+ ", H = " + window.outerHeight);
    }
</SCRIPT>
<HTA:APPLICATION ID="oHTA"
    applicationName="Size Test"
    border="dialog" 
    borderStyle="normal" 
    caption="yes" 
    innerBorder="no"
    maximizeButton="no" 
    minimizeButton="no" 
    navigable="no"
    scroll="no"
    selection="yes"
    showInTaskbar="yes" 
    singleInstance="yes"
    sysMenu="no"
    windowState="normal"
/>
</HEAD>
<BODY>
    <button onclick="ShowSize()">test</button>
</BODY>
</HTML>

警告对话框显示“W =未定义,H =未定义”(该死)。

0 个答案:

没有答案