弹出窗口在 Firefox 中打开全屏,但尺寸已给出
我正在打开一个弹出窗口,它会在 Internet Explorer 和 Mozilla Firefox 中打开。但 Firefox 会忽略给定的大小,因此会创建一个全屏弹出窗口。
以下代码:
<a href="agb.html" target="_blank" onclick="return popup(this.href);">linkname</a>
以下功能:
<script type="text/javascript">
function popup (url) {
fenster = window.open(url, "Popup", "width=640,height=700,resizable=yes,scrollbars=yes");
fenster.focus();
return false;
}
</script>
I'm opening a Popup, it opens in internet explorer and mozilla firefox. But firefox ignores the given sizes, so a fullscreen popup is created.
Following code:
<a href="agb.html" target="_blank" onclick="return popup(this.href);">linkname</a>
Following function:
<script type="text/javascript">
function popup (url) {
fenster = window.open(url, "Popup", "width=640,height=700,resizable=yes,scrollbars=yes");
fenster.focus();
return false;
}
</script>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我在提交给弹出窗口的表单时遇到类似的问题。
我有
(样式是使表单与另一个表单在同一行)
并且弹出功能是
如您所见我已经尝试了顶部和左侧选项,但我的弹出窗口仍然以与主窗口相同的大小打开,并且滚动条、工具栏、菜单栏、目录和位置设置被忽略,无论我将它们的值设置为什么,我都只得到位置栏。
附言。我检查了 Firefox 弹出窗口首选项,它们都是允许的。
I'm having a similar problem with a form submitted to a popup.
I have
(the style is to get the form on the same line as another form)
And the popup function is
As you can see I have tried the top and left options, but my popup still opens at the same size as the main window, and the scrollbar, toolbar, menubar, directories and location settings are disregarded, I get only the location bar no matter what I set their values to.
PS. I checked Firefox popup preferences and they are all allowed.
这是我在一个开发网站上的内容,我知道它可以在 Firefox 中运行(实际上这是我测试过的唯一东西。
我对 js 不太了解,所以我确信我是从网络上的某个地方得到这个的——所以希望它遵循正确的做法,而不是遵循正确的做法。
This is what I have on a dev site which I know at works in Firefox (actually it's the only thing I have tested it on.
I don't know too much about js, so I'm sure I got this from the web somewhere- so hopefully it follows correct practices and what not.
您需要将弹出窗口的显示属性设置为
display: block;
或display: inline-block
以使宽度和高度尺寸生效。You need to make the display property of your popup to be either
display: block;
ordisplay: inline-block
for your width and height dimensions to take effect.会做你想做的事;)
will do what you want ;)