PHP + JS 倒计时跳转提示
收藏已久的 PHP + JS 倒计时跳转提示现在分享出来,喜欢的老铁带走吧。
使用方法:
直接创建一个go.php 文件复制下面代码放进去保存就好了
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="4Dn.NeT" />
<title>跳转提示</title>
<style type="text/css">
<!--
body {
background-color:#F7F7F7;
font-family: Arial;
}
.main {
background-color:#FFFFFF;
font-size: 14px;
color: #666666;
width:650px;
margin:60px auto 0px;
border-radius: 10px;
padding:30px 10px;
list-style:none;
border:#DFDFDF 1px solid;
}
ins, a { text-decoration: none;outline:none;}
#goS{font-size: 40px;}
.goS{font-size: 20px;}
-->
</style>
</head>
<body>
<div align="center" class="main">
<h2 id="g"></h2>
<div id="go">
<p><span class="goS">4Dn.NeT 提示您: </span><span id="goS">10</span> 秒钟后 跳转到 <b><a href="<?php echo $_GET['go']; ?>"><?php echo $_GET['go']; ?></a></b></p>
<p><a href="<?php echo $_GET['go']; ?>">«点击返回</a></p>
</div>
</div>
<script language="javascript" type="text/javascript">
var second = document.getElementById('goS').textContent;
var second = 10;
setInterval("redirect()", 1000);
function redirect(){
if (second < 1){
write('go','');
write('g','正在为您打开 请稍后... ...');
location.href = '<?php echo $_GET['go']; ?>';
}else{
second--;
write('goS',second);
}
}
function write(id,text){
if (navigator.appName.indexOf("Explorer") > -1){
document.getElementById(id).innerText = text;
}else{
document.getElementById(id).textContent = text;
}
}
</script>
</body>
</html>
调用方法:
http://4dn.net/go.php?go=http://4DN.NET
黑蜘蛛