不多说直接上代码,懂的自然懂,不懂的直接抄 。效果网址:zszs.cc zszs.cc/1 zszs.cc/2
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>计算机小芝士</title>
<script>
window.onload = _ => {
// 跳转
const links = [
{path: "/1", url: "https://wwo.lanzoul.com/b00rmwjcuj", text: "压缩包破解(zszs.cc/1)"},
{path: "/2", url: "https://fzllab.com/names/", text: "高科技亚文化取名机(zszs.cc/2)"},
];
const path = window.location.pathname;
for (let linkItem of links) {
if (linkItem.path === path) {
window.location.replace(linkItem.url);
return;
}
}
// 默认
let h3 = document.createElement('h3');
h3.textContent = "抖音@计算机小芝士";
document.body.appendChild(h3);
let navList = document.createElement('ol');
for (let linkItem of links) {
let listItem = document.createElement('li');
let link = document.createElement('a');
link.href = linkItem.url;
link.textContent = linkItem.text;
listItem.appendChild(link);
navList.appendChild(listItem);
}
document.body.appendChild(navList);
}
</script>
</head>
<body>
</body>
</html>