radio button vs textbox ala Javascript

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Mar 2008
Posts: 70
Reputation: forzadraco is an unknown quantity at this point 
Solved Threads: 1
forzadraco forzadraco is offline Offline
Junior Poster in Training

radio button vs textbox ala Javascript

 
0
  #1
Mar 25th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 268
Reputation: Traicey is an unknown quantity at this point 
Solved Threads: 19
Traicey's Avatar
Traicey Traicey is offline Offline
Posting Whiz in Training

Re: radio button vs textbox ala Javascript

 
0
  #2
Mar 25th, 2008
There are many ways to do that but I'd rather use this method

  1. <script language ="javascript>
  2. <!--
  3. function whatever()
  4. {
  5. var TextBoxName = document.FormName.TextBoxName.disabled = true;
  6. var radioButtonNameYes = false;
  7. var radioButtonNameNo = false;
  8. if(document.nameOftheForm.radioButtonName(yes).checked)
  9. {
  10. radioButtonName = true;
  11. document.FormName.textBoxName.disabled=false;
  12. document.FormName.textBoxname.value = " ";
  13. } else
  14. {
  15. //do the "No" radio button
  16. }
  17.  
  18. }
  19. //-->
  20.  
  21. </script>
  22.  
Last edited by Traicey; Mar 25th, 2008 at 10:52 am.
Some people get so rich they lose all respect for humanity. That's how rich I want to be.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC