亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

javascript實(shí)現(xiàn)5秒倒計(jì)時(shí)并跳轉(zhuǎn)功能

 更新時(shí)間:2019年06月20日 11:23:03   作者:lzpwzy  
這篇文章主要為大家詳細(xì)介紹了javascript實(shí)現(xiàn)5秒倒計(jì)時(shí)并跳轉(zhuǎn)功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了js實(shí)現(xiàn)5秒倒計(jì)時(shí)并跳轉(zhuǎn)功能的具體代碼,供大家參考,具體內(nèi)容如下

<!DOCTYPE html>
<html>
 <head>
 <meta charset="UTF-8">
 <title>倒計(jì)時(shí)五秒</title>
 <script>
 //使用匿名函數(shù)方法
 function countDown(){
 
 var time = document.getElementById("Time");
 //alert(time.innerHTML);
 //獲取到id為time標(biāo)簽中的內(nèi)容,現(xiàn)進(jìn)行判斷
 if(time.innerHTML == 0){
 //等于0時(shí)清除計(jì)時(shí)
 window.location. rel="external nofollow" ;
 }else{
 time.innerHTML = time.innerHTML-1;
 }
 }
 //1000毫秒調(diào)用一次
 window.setInterval("countDown()",1000);
 </script>
 <style>
 #Time,#p{
 font-size: 100px;
 text-align: center;
 }
 </style>
 </head>
 <body>
 <p id="Time">5</p>
 </body>
</html>

再為大家分享兩段:

jQuery實(shí)現(xiàn)5秒倒計(jì)時(shí)

<script src="jquery-1.8.2.min.js"></script>
<script type="text/javascript">
var i=5;
$(function(){
 setTimeout(function(){
 window.location.href='${ctx}/';
 },5000);//5秒后返回首頁(yè)
 after();
});
//自動(dòng)刷新頁(yè)面上的時(shí)間
function after(){
 $("#time").empty().append(i);
 i=i-1;
 setTimeout(function(){
 after();
 },1000);
}
</script>

點(diǎn)擊按鈕出現(xiàn)5秒倒計(jì)時(shí)js代碼

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無(wú)標(biāo)題文檔</title>
<script type="text/javascript" src="js/jquery.js"></script>
</head>

<body>
 <input type="button" id="btn" value="免費(fèi)獲取驗(yàn)證碼" onclick="settime(this)" />

 <script type="text/javascript"> 
var countdown=5; 
function settime(val) { 
if(countdown != 0){
val.setAttribute("disabled", true); 
val.value="重新發(fā)送(" + countdown + ")"; 
countdown--; 
}else {
 val.removeAttribute("disabled"); 
 val.value="免費(fèi)獲取驗(yàn)證碼"; 
 countdown = 5;

return;//避免無(wú)限循環(huán)
 } 
setTimeout(function() {
settime(val) 
},1000) 
}
</script>
</body>
</html>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論