Posted By

krisdb on 03/09/07


Tagged

javascript


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


toggle using checkbox


 / Published in: JavaScript
 

  1. <script LANGUAGE="JavaScript" TYPE="text/javascript">
  2.  
  3. function toggleCheckbox(checkboxName,toggleLyr) {
  4.  
  5. var lyr = document.getElementById(toggleLyr);
  6. var checkbox = document.getElementById(checkboxName);
  7.  
  8. if (checkbox.checked == true) {
  9. lyr.style.display = 'block';
  10. }
  11. else {
  12. lyr.style.display = 'none';
  13. }
  14. }
  15.  
  16. </script>
  17.  
  18.  
  19. <input type="checkbox" name="toggleCheckbox" id="toggleCheckbox" onClick="toggleCheckbox(this.name,'toggleLyr');" value="" /> Add Details?
  20.  
  21. <div id="toggleLyr" style="display:none;">
  22.  
  23. </div>

Report this snippet  

You need to login to post a comment.