PDA

View Full Version : read only attribute


Kram
08-16-2004, 11:05 PM
Is there a way to set the readonly attribute of an inpu field? Here is my current code(all of the names are correct):


document.forms[0].address1HO.readonly = "true";

Kram
08-17-2004, 12:38 AM
there seems to be a way of using the onfocus="this.blur()" idea, however, I do not know how to apply this to what I am doing. I want the text input field to be readonly if the user selects a checkbox.

I do not want it to be disabled.

SO i figue that there could be a way to make the text input field readonly by javascript, but cannot figure it out for the life of me

IKLOP
08-17-2004, 12:54 AM
I think this would work:<input type="text" onfocus="if( document.forms[0].checkboxname.checked ) this.blur();">