Template:Iitm/clickhiding
From 2010.igem.org
(Difference between revisions)
Line 1: | Line 1: | ||
- | <script language= | + | <script language=javascript type='text/javascript'> |
- | + | ||
- | function | + | function showDiv(pass) { |
- | + | var divs = document.getElementsByTagName('div'); | |
- | + | for(i=0;i<divs.length;i++){ | |
- | + | if(divs[i].id.match(pass)){//if they are 'see' divs | |
- | + | if (document.getElementById) // DOM3 = IE5, NS6 | |
- | + | divs[i].style.visibility="visible";// show/hide | |
- | + | else | |
- | + | if (document.layers) // Netscape 4 | |
- | if (document. | + | document.layers[divs[i]].display = 'visible'; |
- | + | else // IE 4 | |
- | + | document.all.divs[i].visibility = 'visible'; | |
- | if (document.layers) | + | } else { |
- | document.layers[ | + | if (document.getElementById) |
- | } | + | divs[i].style.visibility="hidden"; |
- | if (document.getElementById | + | else |
- | + | if (document.layers) // Netscape 4 | |
- | + | document.divs[i].visibility = 'hidden'; | |
+ | else // IE 4 | ||
+ | document.all.divs[i].visibility = 'hidden'; | ||
} | } | ||
} | } | ||
+ | } | ||
</script> | </script> |
Revision as of 20:13, 27 October 2010
<script language=javascript type='text/javascript'>
function showDiv(pass) { var divs = document.getElementsByTagName('div'); for(i=0;i<divs.length;i++){ if(divs[i].id.match(pass)){//if they are 'see' divs if (document.getElementById) // DOM3 = IE5, NS6 divs[i].style.visibility="visible";// show/hide else if (document.layers) // Netscape 4 document.layers[divs[i]].display = 'visible'; else // IE 4 document.all.divs[i].visibility = 'visible'; } else { if (document.getElementById) divs[i].style.visibility="hidden"; else if (document.layers) // Netscape 4 document.divs[i].visibility = 'hidden'; else // IE 4 document.all.divs[i].visibility = 'hidden'; } } } </script>