So I'm trying to disable a button while processing JavaScript, when javascript is done, then re-enable it Please. In the code below, except for IE7, I have tried to work in every browser. It ignores only disable and re-enable in IE 7 and it seems that it is still full-time enabled, so in IE 7 How do I get the right behavior?
& lt; Script & gt; Function doSomething () {document.getElementById ("myButton"). Disabled = true; ... xmlhttp = new XMLHttpRequest (); Xmlhttp.open ("GET", url, false); Xmlhttp.send (zero); Feedback = xmlhttp.responseText (); If (response! = "Wrong") {document.getElementById ("myButton"). Disabled = false; } ...} & lt; / Script & gt; & Lt; Form onsubmit = "doSomething (); return back;" & Gt; & Lt; Input type = "submit" id = "myButton" value = "Do Stuff" /> & Lt; / Form & gt; & Lt; Div id = "result" & gt; & Lt; / Div & gt;
disabled does not have toggled right / wrong if you do not have it If you want to enable anything after it has been deactivated, you can delete the disabled attribute completely. To set: document.getElementById ("myButton"). SetAttribute ("disabled", "disabled"); To clear: document.getElementById ("myButton"). Remove Products ("Disabled");
No comments:
Post a Comment