Click to See Complete Forum and Search --> : Disabling a button


mraghu
06-23-2003, 08:44 AM
I am looking for a common javascript code that will disable a button in all the BROWSER versions? Browsers supported are IE, NS and AOL. Thanks.

Gopinath
06-23-2003, 09:11 AM
document.getElementById("cmd_click").disabled=true
bye
-gopi

mraghu
06-23-2003, 09:21 AM
I don't think getElementById is going to work in lower versions of NS like 4.08, 4.77 etc., I wish to avoid writing verison specific code. Any other ideas?

pyro
06-23-2003, 10:22 AM
From the original thread (http://forums.webdeveloper.com/showthread.php?s=&threadid=11138), posted by gil davis:
In fact, the image button does not appear in the form's elements array. So, even my example will not work in NS 4.x. You'll have to change the <input type="image"> to a simple image link with an onclick that submits the form for you, if you want it to work in NS 4.x.

mraghu
06-23-2003, 10:29 AM
If I don't use <input type="image"> and instead I use <input type="button">, then, how do I disable the button in all broswer versions(IE, NS,AOL) using a common Javascript code?