Template:Iitm/clickhiding

From 2010.igem.org

(Difference between revisions)
Line 1: Line 1:
-
<script language="javascript">
+
<script language=javascript type='text/javascript'>
-
var state = 'none';
+
-
function showhide(layer_ref) {
+
function showDiv(pass) {  
-
 
+
var divs = document.getElementsByTagName('div');
-
if (state == 'block') {
+
for(i=0;i<divs.length;i++){  
-
state = 'none';  
+
if(divs[i].id.match(pass)){//if they are 'see' divs
-
}
+
if (document.getElementById) // DOM3 = IE5, NS6
-
else {  
+
divs[i].style.visibility="visible";// show/hide
-
state = 'block';
+
else
-
}
+
if (document.layers) // Netscape 4  
-
if (document.all) { //IS IE 4 or 5 (or 6 beta)
+
document.layers[divs[i]].display = 'visible';
-
eval( "document.all." + layer_ref + ".style.display = state");  
+
else // IE 4
-
}
+
document.all.divs[i].visibility = 'visible';  
-
if (document.layers) { //IS NETSCAPE 4 or below
+
} else {
-
document.layers[layer_ref].display = state;  
+
if (document.getElementById)  
-
}  
+
divs[i].style.visibility="hidden";
-
if (document.getElementById &&!document.all) {
+
else
-
hza = document.getElementById(layer_ref);  
+
if (document.layers) // Netscape 4
-
hza.style.display = state;  
+
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>