Window.open javascript函数没有在Mozilla工作,但在其他浏览器中工作,这里是我写。

<a href="javascript:window.open('../Terms.aspx','Terms','width=550,height=400')">
                click here</a>

其实发生了什么Mozilla是弹出窗口打开,但父窗口是空白与[object Window]

请告诉我,我做错了吗?

由于

有帮助吗?

解决方案

在脚本看上去一切正常,什么可能是一个问题是,你在URL中运行它。使用点击事件来代替。

此外,您还可以使用href和在链接目标属性,使其正常降级。这样的链接将至少打开的页面,即使JavaScript是在浏览器中禁用:

<a href="../Terms.aspx" target="Terms" onclick="window.open(this.href,this.target,'width=550,height=400');return false;">
  click here</a>

其他提示

尝试发电机

另外,你可能想尝试href="javascript: randomVar = window.open ..."。该问题可能是,window.open函数返回的ID,从而打破了在线的JavaScript。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top