Forum Moderators: open
<html>
<head>
<SCRIPT type="text/javascript">
states=new Array()
states[0]="txt"
states[1]="img"
states[2]="vid"
function hideallexcept(elm) {
for (var i = 0; i < states.length; i++) {
var layer = document.getElementById(states[i]);
if (elm!= states[i]) {
layer.style.display = "none";
}
else {
layer.style.display = "block";
}
}
}
</SCRIPT>
</head>
<body>
<DIV id="txt" style="position: absolute; left: 75px; top: 40px; height: 400px; width: 450px; z-index: 2; visibility: visible;">txt-window </div>
<DIV id="img" style="position: absolute; left: 75px; top: 40px; height: 400px; width: 450px; z-index: 2; visibility: visible;">img-window </div>
<DIV id="vid" style="position: absolute; left: 75px; top: 40px; height: 400px; width: 450px; z-index: 2; visibility: visible;">vid-window </div>
<A HREF="#" onclick="hideallexcept('txt');">click to view text</A><BR>
<A HREF="#" onclick="hideallexcept('img');">click to view img</A><BR>
<A HREF="#" onclick="hideallexcept('vid');">click to view vid</A><BR>
</body>
</html>
Well, NN4 doesn't understand document.getElementById. It uses document.layers instead. Now, the other problem is that NN4 doesn't handle display:none correctly. There are times when an element with display:none cannot be "brought back", no matter what you set display to.