有人可以告诉我为什么调整大小在Firefox中不起作用但它在Internet Explorer中有效吗?我无法弄清楚如何在所有浏览器中强制它。我正在尝试将宽度调整为800,将高度调整为475.然后我尝试将其设置为无法最大化浏览器(禁用它)的位置。以及从显示和URL中删除所有工具栏。
function OpenWindow(url, width, height)
{
var features = 'resizable:no;status:yes;dialogwidth:' + width + 'px;dialogheight:' + height + 'px;help:no';
features = features + ';dialogtop:' + (window.screen.availHeight - height) /2;
features = features + ';dialogleft:' + (window.screen.availWidth - width) /2;
window.showModalDialog(url, this, features);
}
function Resize(width, height)
{
var availWidth = window.screen.availWidth;
var availHeight = window.screen.availHeight;
var top = (availHeight - height) / 2;
var left = (availWidth - width) / 2;
if (window.dialogHeight)
{
window.dialogHeight = height + 'px';
window.dialogWidth = width + 'px';
window.dialogLeft = left;
window.dialogTop = top;
}
else
{
var _win;
if(window.parent) _win = window.parent;
else _win = window;
_win.resizeTo(width, height);
_win.moveTo(left, top);
}
}
Resize(800, 475);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
任何建议都会有所帮助。我不明白为什么事情在某些浏览器中起作用而在其他浏览器中不起作用。