0

我有以下在 Firefox 中运行但在 IE 和 Chrome 中不起作用的代码。我也更改了窗口大小(高度和宽度)。但是其他浏览器没有变化。它只在 FireFox 中运行良好。

<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="expires" content="Fri, 30 Dec 2005 12:00:00 GMT" />
<meta http-equiv="cache-control" content="no-cache" />
<title>RSI Q</title>
<script>
function OpenNewWindow()
{
    var WindowWidth=250;
    var WindowHeight=400;

    // calculate x-distance
    var PageWidth = screen.width;
    var xDistance = parseInt(PageWidth) - parseInt(WindowWidth);

    // calculate y-distance
    var PageHeight = screen.height;
    var yDistance = parseInt(PageHeight) - parseInt(WindowHeight);

    window.open('mypopuppage.php', 'MyPopup', 'fullscreen=0,width='+WindowWidth+',height='+WindowHeight+',resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,top='+yDistance+',left='+xDistance);
}
</script>
</head>
<body onload="OpenNewWindow();">
</body>
</html>

IE 扩展了宽度,chrome 在高度和宽度上都搞砸了。而FF表现良好。http://i50.tinypic.com/2yvnlae.jpg在这里您可以看到不同浏览器中窗口大小的差异

4

0 回答 0