DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/)
-   JavaScript / DHTML / AJAX (http://www.daniweb.com/forums/forum117.html)
-   -   radio button vs textbox ala Javascript (http://www.daniweb.com/forums/thread115546.html)

forzadraco Mar 25th, 2008 12:50 am
radio button vs textbox ala Javascript
 
i hv problem which: i have 2 radio button with value 'yes' and 'no' and one textbox, my question is : default the texbox is disabled and when user choose radio button "yes" the texbox become enabled...

anyone can help me?
thanks

Traicey Mar 25th, 2008 9:47 am
Re: radio button vs textbox ala Javascript
 
There are many ways to do that but I'd rather use this method

  1. <script language ="javascript>
  2. <!--
  3. function whatever()
  4.     var TextBoxName = document.FormName.TextBoxName.disabled = true;
  5.     var radioButtonNameYes = false;
  6.     var radioButtonNameNo = false;
  7.     if(document.nameOftheForm.radioButtonName(yes).checked)
  8.     {
  9.         radioButtonName = true;   
  10.         document.FormName.textBoxName.disabled=false;
  11.         document.FormName.textBoxname.value = " ";
  12.     } else
  13.             {
  14.               //do the "No" radio button
  15.             }
  16.  
  17. }
  18. //-->
  19.  
  20. </script>
  21.  


All times are GMT -4. The time now is 10:58 am.

Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC