Forum Moderators: open
function toggleMenu(divName) {
if (divName.style.display == "none") {
divName.style.display = "";
divName.style.z-index = "2";
}
else {
divName.style.display = "none";
}
}
The default div is menuOne, the other divs are menuTwo and menuThree. Using a mouseover event - onMouseOver="toggleMenu(menuTwo)" - I want the other divs to replace the first, but I can't get it to work.
Thanks for any help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Div Swap 04.13.04</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
div#d_one{position:absolute;height:400px;width:400px;background:blue;}
div#d_two{position:absolute;height:200px;width:400px;background:red;visibility:hidden;}
div#d_three{position:absolute;top:200px;height:200px;width:400px;background:green;visibility:hidden;}
-->
</style>
<script type="text/javascript">
<!--
function divSwap(){
var bye_bye=document.getElementById("d_one");
var hi_one=document.getElementById("d_two");
var hi_two=document.getElementById("d_three");
bye_bye.style.visibility="hidden";
hi_one.style.visibility="visible";
hi_two.style.visibility="visible";
}
//-->
</script>
</head>
<body>
<div onmouseover="divSwap();">
<div id="d_one"></div>
<div id="d_two"></div>
<div id="d_three"></div>
</div>
</body>
</html>
Obviously, you will have to employ some onmouseout code to return things to the original.
Hope this is more clear.
Thanks again.