checking a checkbox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy Lee

    checking a checkbox

    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




  • Lasse Reichstein Nielsen

    #2
    Re: checking a checkbox

    "Andy Lee" <no_email@no_em ail.com> writes:
    [color=blue]
    > 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[/color]

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

    No, but there isn't a checkbox collection, just a general element
    collection.


    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...