By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

checking a checkbox

P: n/a
Hi

I am trying to find a way of checking a checkbox in Javascript based on its
value and not its index.

ie document.form1.checkbox['name'].checked = true

or can it only be done with the index ?
Thanks

AL


Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Andy Lee" <no_email@no_email.com> writes:
I am trying to find a way of checking a checkbox in Javascript based on its
value and not its index.

ie document.form1.checkbox['name'].checked = true
Try:
document.forms['form1'].elements['name'].checked = true;
or can it only be done with the index ?


No, but there isn't a checkbox collection, just a general element
collection.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.