Posted By

cmslounge on 05/11/07


Tagged

javascript toggle


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

basicmagic
tmarkiewicz
vali29


Javascript toggle a div layer visibility


 / Published in: JavaScript
 

  1. function toggleLayer(whichLayer) {
  2. if (document.getElementById) {
  3. var style2 = document.getElementById(whichLayer).style;
  4. style2.display = style2.display? "":"block";
  5. } else if (document.all) {
  6. var style2 = document.all[whichLayer].style;
  7. style2.display = style2.display? "":"block";
  8. } else if (document.layers) {
  9. var style2 = document.layers[whichLayer].style;
  10. style2.display = style2.display? "":"block";
  11. }
  12. }

Report this snippet  

You need to login to post a comment.