change state of button using javascript code example
Example 1: javascript change color of button
document.getElementById("button").style.background='#000000';
Example 2: javascript change button onclick
function Bar() {
document.getElementById("a").onclick = Foo();
}