检测到您启用了Adblock等屏蔽广告扩展,导致正常的内容图片无法显示,为了不影响阅读体验,建议您将www.xiaoz.me加入白名单。

使用JavaScript倒计时跳转到指定网页

某些朋友的顶级域名可能暂时不打算使用,想利用此页面跳转到其它网站怎么办呢?利用JavaScript进行倒计时,不仅让用户看到了通知还达到了跳转目的,写了一段简单的js做个记录。复制下面的代码并另存为xxx.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!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://www.xiaoz.me/wp-content/uploads/2014/11/loading.gif" width = "120" height = "120" /></center>
	网站正在建设中...敬请期待。<span id = "hm">5</span>秒后将跳转到男女派博客!<br />
	如果5秒后无反应,请<a href = "http://blog.nannvpai.com" title = "访问男女派博客">点此链接</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>

演示地址:www.nannvpai.com

5 Comments

发表评论

电子邮件地址不会被公开。 必填项已用*标注