[Solved] How to create a button with two states? [closed]


http://jsfiddle.net/z2J3B/2/

include the function in your head

function test() {
    var submit = document.getElementById("submit");
    var message = document.getElementById("message");
    if (submit.className == "check") {
        submit.setAttribute("disabled");
        var inc = 10;
        message.innerHTML = "you have " + inc + " seconds left, check the form";
        var interval = setInterval(function () {
            inc--;
            message.innerHTML = "you have " + inc + " seconds left, check the form";
            if (inc <= 0) {
                clearInterval(interval);
                message.innerHTML = "you can now submit the form";
                submit.removeAttribute("class");
                submit.removeAttribute("disabled");
            }
        }, 1000);
        return false;
    }
}

1

solved How to create a button with two states? [closed]