Click to See Complete Forum and Search --> : Disabled property doesn't work


redundguy
06-06-2003, 01:53 AM
I need to use the “disabled” property of a form control (like button, or text, or select).
This property works fine with Internet Explorer but it doesn't work with Netscape: with Netscape the control isn't disabled! (I use disabled=”true”). How can I use "disabled" property with Netscape?
Also, these form control objects have the “disabled” property that can be set in JavaScript with Internet Explorer, but Netscape Javascript don't recognize this property. Why?

JHL
06-06-2003, 02:43 AM
Newer version of Netscape(6, 7) support disabled as there are HTML 4 compliant.

Older version of Netscape(4 or below) browser doesn't support it as the feature does not exist when the browser is written.

A workaround for it is to set the onfocus and onclick handler for the form element.

Example(tested in NN4.7, NS7 & IE5.5):

<form>
<input type="text" onfocus="blur();" disabled>
<input type="button" value="click" onclick="return false;" disabled>
<br>
<select disabled onfocus="blur();">
<option>never can change</option>
<option>you will never see this</option>
<option selected>you have to have this selected</option>
</select>
</form>

The bad thing is that the element will not have the grey effect.