文件内容格式:一行标题一行链接
fetch('文件.txt')
.then(response => response.text())
.then(data => {
const lines = data.split('\n');
for (let i = 0; i < lines.length; i += 2) {
const title = lines[i];
const link = lines[i + 1];
const a = document.createElement('a');
a.href = link;
a.textContent = title;
document.body.appendChild(a);
}
});