<!DOCTYPE html>
<html>
<head>
<title>创建超链接</title>
</head>
<body>
<label for="input-box">输入框:</label>
<textarea id="input-box" rows="5"></textarea>
<button onclick="createLinks()">创建超链接</button>
<br>
<label for="output-box">输出框:</label>
<textarea id="output-box" rows="5" readonly></textarea>
<script>
function createLinks() {
// 获取输入框内容
var inputBox = document.getElementById("input-box");
var inputText = inputBox.value.trim();
// 按换行符分割输入框内容
var inputLines = inputText.split("\n");
// 创建超链接
var outputText = "";
for (var i = 0; i < inputLines.length; i += 2) {
var title = inputLines[i];
var link = inputLines[i+1];
outputText += "<a href='" + link + "'>" + title + "</a>\n";
}
// 显示输出框
var outputBox = document.getElementById("output-box");
outputBox.value = outputText;
}
</script>
</body>
</html>