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

javascript頁面倒計時實例

 更新時間:2015年07月25日 17:01:05   作者:whylyq  
這篇文章主要介紹了javascript頁面倒計時實現(xiàn)方法,可實現(xiàn)簡單的頁面倒計時及自動提交表單功能,非常簡單實用,需要的朋友可以參考下

本文實例講述了javascript頁面倒計時實現(xiàn)方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

<html>
 <head>
  </head>
  <body>
   <input type="text" name="mss" id="mss"/>
   <form action="./index.html">
    <input type="text" value="name" name="name"/>  
   </form>
  <body>
</html>
<script type="text/javascript">
<!--
  window.onload=function(){
    daojishi();
   }
   var counttime=120*60;//總秒鐘
   function daojishi(){
   if(counttime>=0){
       var ms = counttime%60;//余數(shù) 89%60==29秒
       var mis = Math.floor(counttime/60);//分鐘
       if(mis>=60){
       var hour=Math.floor(mis/60);
       mis=Math.floor((counttime-hour*60*60)/60);
       document.getElementById("mss").value=hour+"小時"+mis+"分"+ms+"秒數(shù)";
       }else if(mis>=1){
       document.getElementById("mss").value=mis+"分"+ms+"秒數(shù)"; 
       }else{
       document.getElementById("mss").value=ms+"秒數(shù)"; 
       }
       counttime--;
       vartt = window.setTimeout("daojishi()",1000);
  }else{
    window.clearTimeout(vartt);
    window.confirm("考試時間結(jié)束,請單擊提交"); 
    tijiao();
  }
}
   function tijiao(){
    document.forms[0].submit();
   }
//-->
</script>

希望本文所述對大家的javascript程序設(shè)計有所幫助。

相關(guān)文章

最新評論