Publish: 2014-11-28 | Modify: 2018-10-03
Some friends may not want to use their top-level domain names temporarily and want to use this page to redirect to other websites. How to do it? Use JavaScript to countdown, not only let users see the notification, but also achieve the purpose of redirection. I wrote a simple js to make a record. Copy the code below and save it as xxx.html
```html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="小z">
<meta name="Keywords" content="男女派">
<meta name="Description" content="男女派">
<title>男女派官网</title>
<style type = "text/css">
body {
font-family:微软雅黑;
font-size:14px;
}
.show {
width:600px;
height:auto;
margin-left:auto;
margin-right:auto;
margin-top:12%;
text-align:center;
/*background-color:#fffcef;*/
/*border:1px solid #ff7102;*/
color:#33cc33;
padding:10px;
line-height:20px;
}
.show a {
text-decoration:none;
color:#0066cc;
}
</style>
</head>
<body onload = "jump()">
<div class = "show">
<center><img src = "https://cdn.xiaoz.top/wp-content/uploads/2014/11/loading.gif" width = "120" height = "120" /></center>
The website is under construction... Please look forward to it. It will redirect to the Nannvpai blog in <span id = "hm">5</span> seconds!<br />
If there is no response after 5 seconds, please <a href = "http://blog.nannvpai.com" title = "Visit Nannvpai Blog">click here</a>.
</div>
<script>
function url() {
document.location= "http://blog.nannvpai.com";
}
function foure() {
document.getElementById("hm").innerHTML = 4;
setTimeout("three()",1000);
}
function three() {
document.getElementById("hm").innerHTML = 3;
setTimeout("two()",1000);
}
function two() {
document.getElementById("hm").innerHTML = 2;
setTimeout("one()",1000);
}
function one() {
document.getElementById("hm").innerHTML = 1;
setTimeout("zero()",1000);
}
function zero() {
document.getElementById("hm").innerHTML = 0;
return url();
}
function jump() {
var t = setTimeout("foure()",1000);
}
</script>
</body>
</html>
Demo Address:www.nannvpai.com
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.