gpt4 book ai didi

javascript - 试图在javascript中打开多个窗口

转载 作者:行者123 更新时间:2023-12-02 17:40:23 29 4
gpt4 key购买 nike

我需要点击一个按钮打开多个网址。我在 Chrome 上测试PS:我这样做是为了我自己。我只是想打开我每天早上想阅读的所有网址。例如,我不想浪费时间点击每个网址。不确定 javascript 是否是构建此类功能的正确工具写了下面的代码并没有打开,只打开第一个和最后一个url

<html>
<head>
<title>Shopping</title>
<script>

function Software()
{
window.open("http://forums.asp.net/", "status=1,toolbar=1,menubar=1");
window.open("http://www.joelonsoftware.com/", "status=1,toolbar=1,menubar=1");
window.open("http://blog.cwa.me.uk/", "status=1,toolbar=1,menubar=1");
window.open("http://www.lifehacker.com/", "status=1,toolbar=1,menubar=1");
window.open("http://www.Theverge.com", "status=1,toolbar=1,menubar=1");
window.open("http://www.hanselman.com/", "status=1,toolbar=1,menubar=1");
window.open("http://www.goodreads.com", "status=1,toolbar=1,menubar=1");
window.open("http://www.stackoverflow.com", "status=1,toolbar=1,menubar=1");
}

</script>
</head>
<body>
<a href="http://www.channel9.msdn.com/" onclick="Software()">
Software / Programming
</a>
</body>
</html>

最佳答案

给你的窗口唯一的名字:

function Software() {
window.open("http://forums.asp.net/", "w1", "status=1,toolbar=1,menubar=1");
window.open("http://www.joelonsoftware.com/", "w2", "status=1,toolbar=1,menubar=1");
window.open("http://blog.cwa.me.uk/", "w3", "status=1,toolbar=1,menubar=1");
window.open("http://www.lifehacker.com/", "w4", "status=1,toolbar=1,menubar=1");
window.open("http://www.Theverge.com", "w5", "status=1,toolbar=1,menubar=1");
window.open("http://www.hanselman.com/", "w6", "status=1,toolbar=1,menubar=1");
window.open("http://www.goodreads.com", "w7", "status=1,toolbar=1,menubar=1");
window.open("http://www.stackoverflow.com", "w8", "status=1,toolbar=1,menubar=1");
}

请注意,这些链接将作为实际窗口而不是选项卡打开。

演示:http://jsfiddle.net/9xBv7/

关于javascript - 试图在javascript中打开多个窗口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21607983/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com