Loading ...
Sorry, an error occurred while loading the content.

how to disable text box using option button using script

Expand Messages
  • bharani dharan
    hi friends, i have two 3 text boxes, and 2 radio button. option button 1 option button 2 textbox1 textbox2 textbox3 if click (option button 1 ) i have to
    Message 1 of 2 , Mar 6, 2006
    • 0 Attachment
      hi friends,
       
                i have two 3 text boxes, and 2 radio button. 
       
      option button 1  option button 2
       
      textbox1
       
      textbox2
       
      textbox3
       
      if click  (option button 1 )
      i have to disabled the third textbox3
       
      if click  (option button 2 )
       
      i have to disabled
       
      textbox2
       
      textbox3
       
      i had tried a lot to do this, i am not able to do, plz help me thru code.
       
      bye
      bharnidharank


      Yahoo! Mail
      Use Photomail to share photos without annoying attachments.
    • Daniel Rodriguez
      I m not sure if this question is inside the scope of this group, but here s what worked for me: I ve tested it on IE 6.0 & FF
      Message 2 of 2 , Mar 7, 2006
      • 0 Attachment

        I’m not sure if this question is inside the scope of this group, but here’s what worked for me:

         

        I’ve tested it on IE 6.0 & FF

         

        <head>

        <script language="JavaScript" type="text/JavaScript">

        //----------------disable by object id------------------

        function disable (id) {

           obj = document.getElementById(id);

           obj.disabled = true;

        }

         

        //----------------enable by object id------------------

        function enable (id) {

           obj = document.getElementById(id);

           obj.disabled = false;

        }

        </script>

        </head>

        <body>

        <form>

        <p>

          Opt. 1 <input name="opt" type="radio" onClick="javascript:disable('text_box_3');enable('text_box_1');enable('text_box_2');" checked>

        </p>

        <p>

          Opt. 2 <input name="opt" type="radio" onClick="javascript:enable('text_box_3');disable('text_box_1');disable('text_box_2');">

        </p>

        <p>

          Text box 1

          <input name="text_box_1" type="text" id="text_box_1">

        </p>

        <p>

          Text box 2

            <input name="text_box_2" type="text" id="text_box_2">

        </p>

        <p>Text box 3

          <input name="text_box_3" type="text" id="text_box_3" disabled>

        </p>

        </form>

        </body>

         


        From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of bharani dharan
        Sent: Tuesday, March 07, 2006 12:19 AM
        To: ydn-javascript@yahoogroups.com; 1stJavaScript-owner@yahoogroups.com
        Subject: [ydn-javascript] how to disable text box using option button using script

         

        hi friends,

         

                  i have two 3 text boxes, and 2 radio button. 

         

        option button 1  option button 2

         

        textbox1

         

        textbox2

         

        textbox3

         

        if click  (option button 1 )

        i have to disabled the third textbox3

         

        if click  (option button 2 )

         

        i have to disabled

         

        textbox2

         

        textbox3

         

        i had tried a lot to do this, i am not able to do, plz help me thru code.

         

        bye

        bharnidharank


        Yahoo! Mail
        Use Photomail to share photos without annoying attachments.

      Your message has been successfully submitted and would be delivered to recipients shortly.