Posted By

krisdb on 03/09/07


Tagged

javascript


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


toggle display


 / Published in: JavaScript
 

  1. //accepts: element id
  2. //returns: turns display on or off, using visibility or display
  3. function toggleDisplay(DomObject) {
  4.  
  5. if (DomObject.style.visibility) {
  6. DomObject.style.visibility = (DomObject.style.visibility == 'visible') ? 'hidden' : 'visible';
  7. }
  8. else {
  9. DomObject.style.display = (DomObject.style.display == 'block') ? 'none' : 'block';
  10. }
  11. }

Report this snippet  

You need to login to post a comment.