Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    checking checkbox

    view this code:

    frm=document.forms['form1'];

    if(frm[checkBoxName].checked == "checked")
    {
    alert(frm[checkBoxName].value);
    }
    else
    {
    frm[checkBoxName].checked == ""
    }

    i'm trying to get information about a checkbox and i'm checking to see if it's checked.

    the problem is that the condition is never true (even if it's marked as "checked".

    i've added the "else" just to see if it recognize it, and it does uncheck it.

    where is the problam then?

  • #2
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Code:
     if(frm[checkBoxName].checked )
    {
       it is checked
    }
    or
    Code:
    if(frm[checkBoxName].checked == true)
    {
        it is checked
    }
    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #3
    New Coder
    Join Date
    Jan 2006
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    thanks man


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •