tags:

views:

43

answers:

2

I have a javascript function which opens a window and have a javascript which also opens another window and i want to open boths windows on one click.

'<script type="text/javascript">function clickme() { window.open('http://www.google.com/'); } </script>'

'<a href="#" onclick="clickme();">
<script type="text/javascript" src="http://ads.clicmanager.fr/exe.php?c=17346&amp;s=29646&amp;t=1&amp;q="&gt;&lt;/script&gt;&lt;/a&gt;'

But unfortunately only the ad is opening and google is not opening. Please help me, I want to open both windows on one click. Thanks

+1  A: 

Hmmmm.... what about

function clickme()
      {
      window.open('http://www.google.com/');
      window.open('http://www.stackoverflow.com/');          
      }

it works for me!

nico
+1  A: 

Call window.open function two times in your function:

window.open('url_one', 'win1', 'settings');
window.open('url_two', 'win2', 'settings');

function clickme(){
    window.open('http://www.google.com', 'google');
    window.open('http://www.yahoo.com', 'yahoo');
}
Sarfraz
Rizwan Aaqil
@Rizwan Aaqil: You just specify the `src` value in window.open. Let me know if you still have problem.
Sarfraz