簡體   English   中英

Window.open javascript函數在Mozilla中不起作用,但在其他瀏覽器中起作用

[英]Window.open javascript function is not working in Mozilla, but working in other browsers

Window.open javascript函數在Mozilla中不起作用,但是在其他瀏覽器中起作用,這就是我寫的內容。

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

實際上,在Mozilla發生的事情是打開彈出窗口,但父窗口空白為[object Window]

請告訴我我做錯了什么?

謝謝

該腳本看起來不錯,可能是您在URL中運行該腳本。 請改用click事件。

另外,您可以在鏈接中使用href和target屬性,以使其正常降級。 這樣,即使瀏覽器中禁用了Java腳本,該鏈接也至少會打開頁面:

<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 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM