Results 1 to 2 of 2

Thread: [RESOLVED] So why isn't this working?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    113

    Resolved [RESOLVED] So why isn't this working?

    Thanks in advance for taking a look at this, I'm a beginner at this. If I were to replace function(){ document.getElementById("stsbutton").innerHTML="<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit"/>";} with something else like an alert() it works 3 seconds after loading the page, otherwise nothing happens.

    What I currently have (red&bold code does not work):

    Code:
    <script type="text/javascript">
    var myCounter = new Countdown({  
        seconds:3,  // number of seconds to count down
        onUpdateStatus: function(sec){console.log(sec);}, // callback for each second
        onCounterEnd: function(){ document.getElementById("stsbutton").innerHTML="<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit"/>";}
    });
    
    myCounter.start();
    
    function Countdown(options) {
      var timer,
      instance = this,
      seconds = options.seconds || 10,
      updateStatus = options.onUpdateStatus || function () {},
      counterEnd = options.onCounterEnd || function () {};
    
      function decrementCounter() {
        updateStatus(seconds);
        if (seconds === 0) {
          counterEnd();
          instance.stop();
        }
        seconds--;
      }
    
      this.start = function () {
        clearInterval(timer);
        timer = 0;
        seconds = options.seconds;
        timer = setInterval(decrementCounter, 1000);
      };
    
      this.stop = function () {
        clearInterval(timer);
      };
    }
    
    function SetButtonStatus(sender, target)
    {
    
    if ( sender.value.length >= 12 )
    document.getElementById(target).disabled = false;
    
    else
    
    document.getElementById(target).disabled = true;
    }
    
    </script>
    
    <script type="text/javascript">
    var myCounter = new Countdown({  
        seconds:2,  // number of seconds to count down
        onUpdateStatus: function(sec){console.log(sec);}, // callback for each second
        onCounterEnd: function(){ document.getElementById("stsbutton").innerHTML="<input id="saveForm" class="button_text" type="submit" name="submit" value="Submit"/>";}
    });
    
    myCounter.start();
    
    function Countdown(options) {
      var timer,
      instance = this,
      seconds = options.seconds || 10,
      updateStatus = options.onUpdateStatus || function () {},
      counterEnd = options.onCounterEnd || function () {};
    
      function decrementCounter() {
        updateStatus(seconds);
        if (seconds === 0) {
          counterEnd();
          instance.stop();
        }
        seconds--;
      }
    
      this.start = function () {
        clearInterval(timer);
        timer = 0;
        seconds = options.seconds;
        timer = setInterval(decrementCounter, 1000);
      };
    
      this.stop = function () {
        clearInterval(timer);
      };
    }
    
    function SetButtonStatus(sender, target)
    {
    
    if ( sender.value.length >= 12 )
    document.getElementById(target).disabled = false;
    
    else
    
    document.getElementById(target).disabled = true;
    }
    
    </script>
    
    <div id="stsbutton"><b>Submit</b> button will be available in <b>3</b> seconds...</div>

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Feb 2008
    Posts
    113

    Re: So why isn't this working?

    Found the answer, no space between / and > in value="Submit"/>

    Thanks anyway

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width