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
    Dec 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check state of radio button?

    How do I check the state of a radio button? I am new to javascript.

    My button that expands a hidden table:
    <INPUT type="radio" name="ship" onclick="toggletable('expand1','Y'); return true;" CHECKED><a>Yes</a>
    &nbsp;
    <INPUT type="radio" name="ship" onclick="toggletable('expand1','N'); return true;"><A>No</A>

    Where I need help:

    <input type="image" src="./images/checkout.gif" name="submit" value="Submit" onClick="if (ship[1] ){createTel(); return checkForm();}">

    Everything works except where I have ship[1]. The second radio needs to execute the two functions with the onClick. Thanks!
    Last edited by javajeff; 12-31-2007 at 09:33 PM.

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,640
    Thanks
    0
    Thanked 649 Times in 639 Posts
    if (ship[1].checked)
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New Coder
    Join Date
    Dec 2007
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you. I knew it was something simple, but did not know the exact format.

    Regards,

    Jeff


  •  

    Posting Permissions

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