Posted By

fackz on 10/29/09


Tagged

show div hide


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

fackz


show hide div


 / Published in: JavaScript
 

  1. <script>
  2.  
  3. var browserType;
  4.  
  5. if (document.layers) {browserType = "nn4"}
  6. if (document.all) {browserType = "ie"}
  7. if (window.navigator.userAgent.toLowerCase().match("gecko")) {
  8. browserType= "gecko"
  9. }
  10.  
  11. function hide() {
  12. if (browserType == "gecko" )
  13. document.poppedLayer =
  14. eval('document.getElementById("addusuario")');
  15. else if (browserType == "ie")
  16. document.poppedLayer =
  17. eval('document.getElementById("addusuario")');
  18. else
  19. document.poppedLayer =
  20. eval('document.layers["realtooltip"]');
  21. document.poppedLayer.style.visibility = "hidden";
  22. }
  23.  
  24. function show() {
  25. if (browserType == "gecko" )
  26. document.poppedLayer =
  27. eval('document.getElementById("addusuario")');
  28. else if (browserType == "ie")
  29. document.poppedLayer =
  30. eval('document.getElementById("addusuario")');
  31. else
  32. document.poppedLayer =
  33. eval('document.layers["realtooltip"]');
  34. document.poppedLayer.style.visibility = "visible";
  35. }
  36.  
  37. </script>
  38.  
  39.  
  40. <a href="#" onClick="show()">Show</a>
  41. <a href="#" onClick="hide()">Hide</a>
  42.  
  43. <div id="addusuario" style="visibility:hidden;">
  44. Content here
  45. </div>

Report this snippet  

You need to login to post a comment.