Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript: Checkbox read only problem

Status
Not open for further replies.

drbutterboy

Programmer
May 16, 2003
4
US
On a webpage, I have a checkbox called "chkN___EFUN" that's sometimes readonly and I wanted to interrogate its value when the page is submitted.

When the check box is read only I found that referencing this object like so "document.all.chkN___EFUN(0).value" would give me a true/false.

But, when this value was not read only I would need to reference it like this "document.all.chkN___EFUN.value" or I would get the javascript error "Object does not support this method or property".

Does anyone know the best way to handle this situation I can get the value of the check box when its readonly and not readonly?

Thanks!

:(
 
Do you have multiple checkboxes on the same page with the same name? If not I don't see a reason why you'd need to specify chkN___EFUN(0) ever. The (0) should not be necessary if that's the only checkbox with that name. Also, is the value you're trying to pull a true/false value? If so, why not pull .checked instead of .value?

-kaht

banghead.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top