<!DOCTYPE html>
<html>
<head>
<title>批量打开链接</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>批量打开链接</h1>
<label for="input-box">输入链接:</label>
<input type="text" id="input-box">
<button onclick="openLinks()">打开链接</button>
<br><br>
<a href="https://www.baidu.com">百度</a>
<a href="https://www.google.com">谷歌</a>
<a href="https://www.bing.com">必应</a>
<a href="https://www.yahoo.com">雅虎</a>
<a href="https://www.sogou.com">搜狗</a>
<br><br>
<script>
function openLinks() {
var inputBox = document.getElementById("input-box");
var links = document.getElementsByTagName("a");
var output = "";
for (var i = 0; i < links.length; i++) {
output += links[i].href + "\n";
if (inputBox.value !== "") {
window.open(links[i].href + inputBox.value);
} else {
window.open(links[i].href);
}
}
inputBox.value = output;
}
</script>
</body>
</html>