我有以下代码在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的宽度已经扩展,铬的高度和宽度都混乱了。虽然FF表现良好。 http://i50.tinypic.com/2yvnlae.jpg在这里,您可以看到不同浏览器中窗口大小的差异