SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    I'm a college yuppie now! sbdi's Avatar
    Join Date
    Jul 2000
    Location
    Dublin , Ireland
    Posts
    1,271
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing radio button values ?

    Hi,

    Hi, I have a pop-up with 2 radio buttons. I want to pass one value from the pop-up page to the parent.

    I'm not too sure how to do this with radio buttons. Anyone tell me how?

    Code:
     document.getElementById("TextBox1").value=retval;
    Is what I have for textbox. But dont know how to use radio buttons
    Back Again

  2. #2
    SitePoint Evangelist Mr. Brownstone's Avatar
    Join Date
    May 2002
    Location
    Relative
    Posts
    452
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    .checkedíll do ya:
    Code:
    document.getElementById ( 'RadioButton1' ).checked = bWotNot;
    Of course, that's just my opinion. I could be wrong.

  3. #3
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi.
    for the 'non-standards' browser, you will have to loop through the radio button array:
    Code:
    <form>
    <input type="radio" name='x' value="1" \>
    <input type="radio"  name="x" value="2">
    <input type="radio"  name="x" value="3">
    <input type="radio"  name="x" value="4" >
    <input type='button' value="submit it" onclick=doit(this.form)>
    </form>
    <script type="text/javascript">
    <!--
    function doit(formObj)
    {
    var len = formObj.length;
    var el = formObj.elements;
    for (var i = 0; i < len; i++)
    {
    if (el[i].checked)
    alert(el[i].value);
    }
    }
    //-->
    </script>
    Vinny
    Where the World Once Stood
    the blades of grass
    cut me still


Bookmarks

Posting Permissions

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