views:

173

answers:

2

Hi, Window.open javascript function is not working in Mozilla, but working in other browsers, here is what I have write.

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

Actually what happened in Mozilla is popup is opened but parent window is blank with [object Window]

Please tell me What I am doing wrong?

Thanks

+1  A: 

Try a generator.

Alternatively, you might want to try href="javascript: randomVar = window.open ...". The issue might be that the window.open function returns an ID, thus breaking the in-line JavaScript.

roosteronacid
you also provide a good link, I am also Upvoting you. Thanks
Muhammad Akhtar
+2  A: 

The script looks all right, what might be a problem is that you are running it in the URL. Use the click event instead.

Also, you can use the href and target attributes in the link to make it degrade gracefully. That way the link will at least open up the page even if Javascript is disabled in the browser:

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