Results 1 to 2 of 2

Thread: RADIO buttons undefined

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    england
    Posts
    2

    RADIO buttons undefined

    i have the scenario

    <form name="monkey">

    <input type="radio" name="number" value="1">1<br>
    <input type="radio" name="number" value="2">2<br>

    </form>

    and the jscript:

    function whatever()
    {
    var a = monkey.number.value;
    alert(a);
    }

    and the alert says undefined.

    does anyone know why?

    Richard

  2. #2
    New Member
    Join Date
    Feb 2001
    Posts
    15

    Monkey in a muddle

    Yep

    You have two tags called Monkey - in order to reference one of the items you must virst loop through the collection of all tags called Monkey - this is how I do it:-

    var collection = document.all["Monkey"];

    for (var i=0;i<collection.length;i++)
    alert(collection[i].value);
    brock loves to code

Posting Permissions

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



Click Here to Expand Forum to Full Width