0

I have 2 urls
http://www.example.com
and
http://www.nana.com

If I click the below link the above 2 urls should open in two tabs..
a href="#">Click /a

May anyone help me to acheive this one?

Thanks In advance

bhai
  • 305
  • 3
  • 9
  • 19

5 Answers5

3

Try something like this :

<a id="test" href="#"> CLick </a>
<script type="text/javascript">

  document.getElementById("test").onclick = function(){
   window.open("http://www.google.com",'_blank');
   window.open("http://www.p3php.in",'_blank');
}
</script>
Pratik
  • 810
  • 6
  • 26
  • @Pratik..Thank you for your answer..It is worked for me..Thanks again for your valuable time. – bhai Aug 22 '13 at 06:41
1

This should work:

<a href="http://www.example.com" onclick="window.open('http://www.nana.com')">Click</a>
Brett Henderson
  • 3,826
  • 1
  • 14
  • 7
0

Try something like this :

<a href="#" onclick="window.open('http://google.com');
    window.open('http://yahoo.com');" >Click</a>
Mahmood Rehman
  • 4,303
  • 7
  • 39
  • 76
0

Better way to do it

HTML:

<a id="link">Click me!!</a>

JS:

var link = document.getElementById("link");

link.onclick = function() {
    window.open("http://yahoo.com");
    window.open("http://google.com");
};

Cheers!!

bhb
  • 2,476
  • 3
  • 17
  • 32
0

hope this works

<html>
<script>
function pageloader()
{

 window.open("http://www.example.com", '_blank');
 window.open("http://www.google.com", '_blank');

}

</script>
<body>
<a href="#" onclick="pageloader();">Click here </a>


</body>
</html>

goodluck!

user2685803
  • 271
  • 1
  • 3