button N 초 사용 안 함

3407 단어 JavaScripthtmljsp
Method one:
<script type="text/javascript">
var n = 0;
var intervalID; 
function setEnable(){
    n++;
    if(n==5){
        btn.disabled = false;
  //     
  clearInterval(intervalID);
    }else{
        btn.value = "   ("+(5-n)+ ")"; 
    }
}
intervalID = window.setInterval("setEnable()",1000);
</script>
<input type="button" id="btn" name="btn" value="Button" disabled="disabled" />

Method two:
<HTML>
 <HEAD>
  <TITLE> New Document </TITLE>
  <META NAME="Generator" CONTENT="EditPlus">
  <SCRIPT LANGUAGE="JavaScript">
  <!--
    function Show(){
        var obj = document.getElementsByTagName('INPUT');
        for(var i=0;i<obj.length;i++){
            if(obj[i].type == "button"){
                obj[i].disabled = false;
            }
        }
    }
    window.setTimeout("Show()",5000);
  //-->
  </SCRIPT>
 </HEAD>

 <BODY>
  <INPUT TYPE="button" value="button1" disabled="true">
  <INPUT TYPE="button" value="button2" disabled="true">
  <INPUT TYPE="button" value="button3" disabled="true">
  <INPUT TYPE="button" value="button4" disabled="true">
  <INPUT TYPE="button" value="button5" disabled="true">
  <INPUT TYPE="button" value="button6" disabled="true">
  <INPUT TYPE="button" value="button7" disabled="true">
  <INPUT TYPE="button" value="button8" disabled="true">
  <INPUT TYPE="text" NAME="" value="   ">
 </BODY>
</HTML>

 
<input name="agree" disabled="disabled" type="submit" id="agree" value="   " class="sbutton" />
                     
<input name="button" type="button" class="button"  style="cursor:hand;" onclick="window.location.href='index.jsp'" value="    " />
<input name="action" type="hidden" id="action" value="apply" />
<script type="text/javascript">
      var secs = 6;
      var wait = secs * 1000;
      document.getElementById("agree").value = "   (" + secs + ")";
      document.getElementById("agree").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.getElementById("agree").value = "   ";
             } else{
                    printnr = (wait / 1000) - num;
                    document.getElementById("agree").value = "   (" + printnr + ")";
            }
      }
       function timer(){
             document.getElementById("agree").disabled = false;
             document.getElementById("agree").value = "     ";
      }
</script>

좋은 웹페이지 즐겨찾기