Simple implementation of javascript display countdown control button

  • 2021-06-28 08:34:12
  • OfStack

html:

< a > < span id="sendAgain" onclick="sendEmail()" > 2. Send activation mail again < /span > < /a >

(span controls click events, disabled is not valid)

js:


/* Send Mail */
function sendEmail(){// Send Mailbox Authentication Mail 
  var me = $("#sendAgain");
  me.time = 60;
  (function() {
    if (me.time > 1) {
      me.time--;
      me.html("2. Send Again Need (" + me.time + ")");
      setTimeout(arguments.callee, 1000);
      me.attr("onclick","");
    } else {
      me.html("2. Send activation mail again ");
      me.attr("onclick","sendEmail()");
    }
  })();

}

Related articles: