页面倒计时返回

<!DOCTYPE>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>我的秀,我操作</title>
    <style type="text/css" media="screen">
        * {
            margin: 0;
            padding: 0;
            font-family: arial, sans-serif;
            font-size: 14px;
        }
        
        body,
        html {
            height: 100%;
        }
        
        body {
            background: #e9eaef;
        }
        
        .wrapper {
            margin: 0 auto;
            /* 背景图片 */
            background: #fff url(images/bg.png) top center;
            width: 587px;
            height: 196px;
            padding: 80px 0 0 80px;
            top: 50%;
            margin-top: -150px;
            position: relative;
        }
        
        h3 {
            font-weight: 700;
            font-size: 16px;
        }
        
        .tm {
            padding-top: 24px;
        }
        
        .tm span {
            color: #e10602;
            padding: 0 5px;
            font-weight: 700;
        }
        
        .btn {
            padding-top: 14px;
        }
        
        .btn a {
            display: block;
            width: 150px;
            height: 0;
            overflow: hidden;
            padding-top: 30px;
            /* 前往百度首页按钮 */
            background: #00f url(images/go.png) 0 0;
            color: #fff;
        }
    </style>
</head>

<body>
    <div class="wrapper">
        <h3>该功能已关闭,即将跳转到百度首页。</h3>
        <p class="tm">本页<span id="time">5</span>秒内自动跳转...</p>
        <p class="btn"><a id="Btn" href="http://www.baidu.com">前往百度首页</a></p>
    </div>
    <script type="text/javascript">
        function sendStats(url) {
            var n = "log_" + (new Date()).getTime();
            var c = window[n] = new Image();
            c.onload = (c.onerror = function() {
                window[n] = null;
            });
            c.src = 'http://www.baidu.com' + url;
            c = null;
        }

        var time = document.getElementById('time');
        var btn = document.getElementById('Btn');

        function count() {
            if (+time.innerHTML > 0) {
                time.innerHTML = time.innerHTML - 1;
            } else {
                sendStats('gotobaidu');
                location.href = btn.href;
            }
        }
        setInterval(count, 1000);

        btn.onclick = function() {
            sendStats('gotobaidu');
        };
    </script>
</body>

</html>

  

<!DOCTYPE>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>我的秀,我操作</title>
<style type="text/css" media="screen">
* {
margin: 0;
padding: 0;
font-family: arial, sans-serif;
font-size: 14px;
}
 
body,
html {
height: 100%;
}
 
body {
background: #e9eaef;
}
 
.wrapper {
margin: 0 auto;
/* 背景图片 */
background: #fff url(images/bg.png) top center;
width: 587px;
height: 196px;
padding: 80px 0 0 80px;
top: 50%;
margin-top: -150px;
position: relative;
}
 
h3 {
font-weight: 700;
font-size: 16px;
}
 
.tm {
padding-top: 24px;
}
 
.tm span {
color: #e10602;
padding: 0 5px;
font-weight: 700;
}
 
.btn {
padding-top: 14px;
}
 
.btn a {
display: block;
width: 150px;
height: 0;
overflow: hidden;
padding-top: 30px;
/* 前往百度首页按钮 */
background: #00f url(images/go.png) 0 0;
color: #fff;
}
</style>
</head>

<body>
<div class="wrapper">
<h3>该功能已关闭,即将跳转到百度首页。</h3>
<p class="tm">本页<span id="time">5</span>秒内自动跳转...</p>
<p class="btn"><a id="Btn" href="http://www.baidu.com">前往百度首页</a></p>
</div>
<script type="text/javascript">
function sendStats(url) {
var n = "log_" + (new Date()).getTime();
var c = window[n] = new Image();
c.onload = (c.onerror = function() {
window[n] = null;
});
c.src = 'http://www.baidu.com' + url;
c = null;
}

var time = document.getElementById('time');
var btn = document.getElementById('Btn');

function count() {
if (+time.innerHTML > 0) {
time.innerHTML = time.innerHTML - 1;
} else {
sendStats('gotobaidu');
location.href = btn.href;
}
}
setInterval(count, 1000);

btn.onclick = function() {
sendStats('gotobaidu');
};
</script>
</body>

</html>
posted @ 2017-10-30 16:43  Sunsin  阅读(160)  评论(0编辑  收藏  举报