By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,680 Members | 1,486 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,680 IT Pros & Developers. It's quick & easy.

Hiding/unhiding radio buttons when checkbox selected

P: 1
I have 2 radio buttons on my form which are hidden. I need to have these radio buttons visible once a checkbox is selected. The radio buttons are hidden on loading of the form but I cannot make them visible once the check box is checked. The error I get is 'document.radiology.rcontmedia.style' is null or not an object. The code I am using is below. Please note that I have no previous experience programming in javascript.

Expand|Select|Wrap|Line Numbers
  1.  function ContrastEnable() 
  2. {
  3. if (document.Radiology.CTExam.checked == true) {
  4. document.getElementById('ContMediaLabel').innerHTML= '<font 
  5. color="#000000" size="2" face="Arial, Helvetica, sans-serif">Previous 
  6. Reaction to Contrast Media</font>';
  7. document.Radiology.rContMedia.style.visibility = 'visible';
  8. } else {
  9. document.getElementById('ContMediaLabel').innerHTML= '<font 
  10. color="#000000" size="2" face="Arial, Helvetica, sans-serif"></font>';
  11. document.Radiology.rContMedia.style.visibility = 'hidden';
  12.     }
  13. }
  14.  
  15.  
  16. <td width="2%"><font face="arial" size="2">CT</FONT></td> 
  17. <td width="2%">
  18.     <input type="checkbox" name="CTExam" value="1" 
  19. OnClick="ContrastEnable()">
  20. </td>
  21.  
  22.  
  23. <td width="14%" id="ContMediaLabel"></td>
  24. <td width="76%" name="contmedia">
  25. <input type="radio" name="rContMedia" value="No" checked 
  26. style="visibility: hidden;" ContMediaN=""> 
  27. <input type="radio" name="rContMedia" value="Yes" style="visibility: 
  28. hidden;" ContMediaY="">
  29. </td>
  30.  
Thanks
Sam
Aug 11 '05 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.