Ken*_*nci 3 html javascript css
我正在尝试打开一个弹出窗口,使其高度从屏幕顶部到Windows的"应用程序"栏.这是代码:
function windowOpener(windowHeight, windowWidth, windowName, windowUri) {
var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
var centerWidth = (window.screen.width - windowWidth) / 2;
var centerHeight = (window.screen.height - windowHeight) / 2;
newWindow = window.open(windowUri, windowName, 'resizable=0,scrollbars=1,width=' + windowWidth +
',height=' + windowHeight +
',left=' + centerWidth);
newWindow.focus();
return newWindow.name;
}
Run Code Online (Sandbox Code Playgroud)
为什么它在IE中不起作用?(适用于镀铬)
谢谢
我想你只需要screen.width和screen.height.不要在窗口前面添加它们.
编辑:显然IE需要一个"全屏=是"的参数.
试试这个:
<script type="text/javascript">
<!--
function popup(url)
{
params = 'width='+screen.width;
params += ', height='+screen.height;
params += ', top=0, left=0'
params += ', fullscreen=yes';
newwin=window.open(url,'windowname4', params);
if (window.focus) {newwin.focus()}
return false;
}
// -->
</script>
<a href="javascript: void(0)"
onclick="popup('popup.html')">Fullscreen popup window</a>
Run Code Online (Sandbox Code Playgroud)