How can I open two urls in two tabs in a single cl

2019-09-08 16:18发布

This question already has an answer here:

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

标签: php html url tabs
5条回答
聊天终结者
2楼-- · 2019-09-08 16:44

Try something like this :

<a href="#" onclick="window.open('http://google.com');
    window.open('http://yahoo.com');" >Click</a>
查看更多
倾城 Initia
3楼-- · 2019-09-08 16:45

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>
查看更多
The star\"
4楼-- · 2019-09-08 16:48

This should work:

<a href="http://www.example.com" onclick="window.open('http://www.nana.com')">Click</a>
查看更多
forever°为你锁心
5楼-- · 2019-09-08 16:55

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!!

查看更多
祖国的老花朵
6楼-- · 2019-09-08 16:55

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!

查看更多
登录 后发表回答