一键打开多个URL

时间:2013-01-30 02:28:16

标签: javascript html

查看我的代码,它只会打开第一个链接并忽略其余的代码,

<a href="#" onclick="window.open('http://whitepages.co.nz/white-residential/T%20Vu/new-zealand/'); window.open('http://whitepages.co.nz/white-residential/T%20Vu/Auckland Central/'); window.open('http://whitepages.co.nz/white-residential/T%20H%20Vu/new-zealand/'); window.open('http://whitepages.co.nz/white-residential/T%20H%20Vu/Auckland Central/'); window.open('http://whitepages.co.nz/white-residential/H%20Vu/new-zealand/'); window.open('http://whitepages.co.nz/white-residential/H%20Vu/Auckland Central/'); window.open('http://whitepages.co.nz/white-residential/Vu/new-zealand/'); window.open('http://whitepages.co.nz/white-residential/Vu/Auckland Central/'); " class="btn btn-primary">Open All</a>

2 个答案:

答案 0 :(得分:0)

你可以这样使用

<a href="http://www.gmail.com" target="_blank" onclick="window.open('http://www.google.com'); window.open('http://www.yahoo.com');">Link text</a>

答案 1 :(得分:0)

感谢您的评论和回答。它像 thordarson 那样工作。它阻止了浏览器中的弹出窗口。当我启用弹出窗口时,它会在不同的窗口中打开URL