nericksx
asked on
Javascript to swap layer visability onClick
I'm creating a layout with "tabbed pages" where clicking one "tab" shows that layer but hides the currently visable one. I can't figure out how to handle both functions with the one even handler. Does anyone have a simple sample script for this that will work in IE and NS? If it is W3C I would think it would work in both, right?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
background-color=red should read background-color:red same for the other colors else it will not run in NS
ASKER
Cool, but I don't want to swap their z-index because you'll still be able to see the layers underneath. I need to swap the visabilty (visable, hidden). I'm not sure how I would swap in the syntax for visability in the code above. (I like how short it is, tho!)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, I totally cheated and used the built in behaviors in Dreamweaver. I'm totally ashamed but it was pretty slick. Thanks to everyone who responded, points for everyone for going to the effort (esp Gwyn who did write a very elegant script).
function toggle(obj){
if (obj.style.zIndex==1){
temp=document.getElementBy
document.getElementById('d
document.getElementById('d
}
}
</script>
<body>
<div id="d1"
style="position:absolute;t
onclick="toggle(this)"></d
<div id="d2"
style="position:absolute;t
onclick="toggle(this)">
</div>
</body>