PDA

View Full Version : Html object enable/disable


Me_Titus
07-02-2007, 07:20 PM
Hi people,

I would like to know what is the best way to check whether a control is enable or disabled. I will have a function to which I will pass in an html table, the function will then have to perform a set of conditions to perform whether the table is enable/disable. Right now I am testing with Firefox, and as far as I know one can set the disable property in the css or in the object itself, thus is there any proper way of archiving this??

Many thanks,

MeTitus

Kor
07-03-2007, 02:07 PM
The property you are looking for is disabled, but it is a tricky one, as in DOM 0 values are true/false, while DOM 1+ (especially oriented towards XML/XHTML) suggests us to use the "disabled" value for the "disabled" attribute (the same for "readonly") and to remove it when we need an enable look.

We need to know how do you disable/enable the controls, and the HTML example, I guess...

dhomba
07-06-2007, 08:40 AM
If you are speaking about forms use can use

document.formname.fieldname.enabled = true;
document.formname.fieldname.disabled = true;

If you are talking about tables, use visibility property in css

object.style.visibility = "visible";