现在的位置: 首页 > 综合 > 正文

倒计时按钮

2013年10月22日 ⁄ 综合 ⁄ 共 1004字 ⁄ 字号 评论关闭
<body >
<form name="myform" method="post" action="BidApplicationInput.jsp">
  <table width="200" border="0" align="center">
    <tr>
      <td width="53"><input type="button" name="agreesubmit" value="我同意(10)" onclick="javascript:myform.submit()"></td>
      <td width="73">&nbsp;</td>
      <td width="60"><input type="button" name="close" value="拒绝" onclick="javascript:window.close()"></td>
    </tr>
  </table>
   </form>
<script language="javascript">
 var secs = 10;//读取秒数
 var wait = secs * 1000;
 var agreetext=" 我同意 ";
 document.myform.agreesubmit.value = agreetext+"(" + secs + ") ";
 document.myform.agreesubmit.disabled = true;
 for(i = 1; i <= secs; i++) {
  window.setTimeout("update(" + i + ")", i * 1000);
 }
 window.setTimeout("timer()", wait);
 function update(num, value) {
  if(num == (wait/1000)) {
  document.myform.agreesubmit.value = agreetext;
  } else {
  printnr = (wait / 1000)-num;
  document.myform.agreesubmit.value = agreetext+"(" + printnr + ") ";
  }
 }
 function timer() {
  document.myform.agreesubmit.disabled = false;
  document.myform.agreesubmit.value = agreetext;
 }
</script>
</body>

抱歉!评论已关闭.