Results 1 to 2 of 2

Thread: radio button

  1. #1
    Join Date
    Mar 2004
    Posts
    53

    Unanswered: radio button

    hi everybody...
    i have problem with radio button
    in my page i have 2 radio button where one will be label as Aduan staff and enother one will be label as Aduan student. below the radio button there will be a textfield. if they click on the Aduan staff button, automatically the textfield will be written with Aduan staff but if they click on Aduan student the textfield will be empty. i have try some coding but it cannot work.can somebody tell me how to do this..pleaseee

  2. #2
    Join Date
    Oct 2003
    Posts
    357

    radio button

    Hai fisya, try the following

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE></TITLE>
    </HEAD>
    <BODY>
    <script language="JavaScript">
    function addtext()
    {
    if (document.test.name(0).checked==1)
    {
    document.test.Tname.value ="Aduan Staff";
    }
    else if (document.test.name(1).checked==1)
    {
    document.test.Tname.value ="";

    }

    }

    </script>
    <form name="test">
    <input type=radio name="name" value="Aduan Staff" onclick="addtext()">Aduan Staff
    <input type=radio name="name" value="Aduan Student" onclick="addtext()">Aduan Student<p>
    <input type=text name="Tname">
    </form>
    </BODY>
    </HTML>


    Madhivanan

Posting Permissions

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