The following is a distilled version of code I’m using for a menu. It works fine, but I’d like to have a default text and image appear in the submenu column when the page loads. This image-text combo should disappear with the first mouseover, and it doesn’t need to reappear again until the page is reloaded. Is there a simple solution?
Thanks in advance to anyone who can help.
Cheers, Paul Otteson
<html>
<head><title></title>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<style type=”text/css”>
#menu { width: 400px; }
#menu ul { text-align: right; list-style-type: none; width: 130px; border-right: 1px solid #669 }
#menu li { padding-right: 10px; }
#menu li ul { padding-left: 10px; display: none; position: absolute; top: 0; left: 170px; border: none }
#menu li.hover ul { text-align: left; display: block; }
</style>
<script>
window.onload = function() {
var cc = document.getElementById(“submenu”).childNodes;
for(var i = 0; i < cc.length; i++) {
if(cc[i].nodeName && cc[i].nodeName.toLowerCase() == “li”) {
cc[i].onmouseover = function() {
if(window.cmenu && window.cmenu != this)
window.cmenu.className = “”;
(window.cmenu = this).className = “hover”
}
}
}
}
</script>
</head>
<body>
<div id=”menu” >
<ul id=”submenu” style=”position:relative”>
<li><a href=””><b>Menu1</b></a>
<ul>
<li><a href=””>Sub1.1</a>
<li><a href=””>Sub1.2</a>
<li><a href=””>Sub1.3</a>
</ul>
</li>
<li><a href=””><b>Menu2</b></a>
<ul>
<li><a href=””>Sub2.1</a>
<li><a href=””>Sub2.2</a>
</ul>
</li>
</ul>
</div>
</body>
</html>