原文发布时间为:2008-10-17 —— 来源于本人的百度文章 [由搬家工具导入]

<html>
<head>
<title>显示倒计时,完毕提交</title>
<script language=”JavaScript”>      
function   testTime()   {  
      if(sec==-1){
             min–;
        if(min!=-1)
             sec=59;
        else
           document.getElementById(“button1”).click();
      }           
      if(sec>=0)
           document.getElementById(“showTime”).innerHTML = “<font color=red>”+timeFormat

(min)+” : “+timeFormat(sec)+”</font>”;   
      sec–;
}

function timeFormat(time){
     if(time<10)
         return “0”+time;
     else
         return time;
}

function showTime(){
      if(document.all)
setInterval(“testTime()”,1000);
}
</script>
</head>
<body onload=”min=1;sec=12;showTime()”>
<span   id=”showTime”></span>
<br></br>
<button id=”button1″ OnClick=alert(\’时间到,自动提

交!\’);window.location.href=”http://www.baidu.com“>提交</button>
</body>
</html>

版权声明:本文为handboy原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/handboy/p/7148483.html