Rizwan Aaqil
Rizwan Aaqil

Reputation: 55

I want to open 2 windows on 1 click

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&s=29646&t=1&q="></script></a>'

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

Upvotes: 0

Views: 487

Answers (2)

Sarfraz
Sarfraz

Reputation: 382696

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');
}

Upvotes: 1

nico
nico

Reputation: 51640

Hmmmm.... what about

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

it works for me!

Upvotes: 1

Related Questions