SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript and radio button

    I have a piece of javascript code that, under certain situations, will
    try to unset the radio button. This works on netscape 4.77 on windows
    but does not work on netscape 4.7 under unix. The line of code is:

    document.form_name.radio_name.checked = false;

    Does anybody have an idea as to what may be wrong?

    lance

  2. #2
    Spam Can Kill!!! Disk-t's Avatar
    Join Date
    Jul 2001
    Location
    n/a
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:

    {document.form_name.radio_name.checked=false}

  3. #3
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's nothing wrong with that code, could you show us some more?

    aDog

  4. #4
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That is exactly what I thought, that there is nothing wrong with that code. There really is nothing more to show. That is why I am stumped.

    I did find that the value, after the statement, of the radio is false but the screen does not update to reflect the radio state of false. Is there a way to refresh the radio?

    I did not want to do a form reset because the user may have already made valid changes to other fields.

    lance

  5. #5
    SitePoint Member
    Join Date
    Aug 2001
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, I have come up with a test script.
    This fails on Netscape unix versions 4.7 and 4.77. It will not set
    the state of the radio button to false. I tried it on Opera, under
    unix, and it did what it was supposed to do.


    Here is the code.

    lance

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <SCRIPT language="javascript">
    function doOp() {
    document.test.therad.checked=false;
    }
    </SCRIPT>
    </HEAD>

    <BODY>
    <FORM METHOD=POST NAME="test" ACTION="<?=$PHP_SELF?>">
    <INPUT TYPE="radio" NAME="therad" onclick="doOp();"><BR>
    <INPUT TYPE="submit" NAME="btnSubmit">
    </FORM>
    </BODY>
    </HTML>

  6. #6
    JavaScript Guru (Big Ego) Arielladog's Avatar
    Join Date
    Jul 1999
    Location
    SC, USA
    Posts
    390
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Under WinME, your code works in IE 5.5b, Mozilla 0.9.3, and Netscape 4.7.

    aDog


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
  •