...

View Full Version : DropDown menu problem in IE



vizualbyte
10-27-2004, 11:01 PM
Hi, I'm fairly new to coding and such. I tried following the guide to making this on http://www.alistapart.com/articles/horizdropdowns/
I am currently having problems trying to get me submenus to show up in IE. the following code works on netscape just fine. Can anyone help me out on this issue? please be gentle since i am a noob

heres the code:

<html>
<head>
<title>Submenu Creation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
ul {
id: nav;
font-family: "Arial", "Helvetica", sans-serif;
margin: 0;
padding: 0;
list-style: none;
width: 150px;
border-bottom: 1px solid #ccc;
}


ul li {
position: relative;
}

li ul {
position: absolute;
left: 149px;
top: 0;
display: none;
}

ul li a {
display: block;
text-decoration: none;
color: #777;
background: #fff;
padding: 5px;
border: 1px solid #ccc;
border-bottom: 0;
}
li:hover ul, li.over ul {
display: block; }

/* Fix IE. Hide from IE Mac \*/
* html ul li { float: left; height: 1%; }
* html ul li a { height: 1%; }
/* End */

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replaceĽ
(" over", "");
}
}
}
}
}
window.onload=startList;
}

</style>

</head>

<body bgcolor="#FFFFFF" text="#000000">
<ul>
<li><a href="#">Network</a>
<ul>
<li><a href="#">Audit</a></li>
<li><a href="#">Integrate</a></li>
<li><a href="#">Expand</a></li>
<li><a href="#">Relocate</a></li>
</ul>
</li>
<li><a href="#">Security</a>
<ul>
<li><a href="#">Audit</a></li>
<li><a href="#">Assess</a></li>
<li><a href="#">Identify</a></li>
<li><a href="#">Encrypt</a></li>
</ul>
</li>
<li><a href="#">Planning</a>
<ul>
<li><a href="#">Security Schema</a></li>
<li><a href="#">Network Design</a></li>
<li><a href="#">Wireless design</a></li>
<li><a href="#">Business Continuity & Disaster Recovery</a></li>
<li><a href="#">Policy and Governance</a></li>
</ul>
</li>
<li><a href="#">Support</a>
<ul>
<li><a href="#">Infrastructure</a></li>
<li><a href="#">Help Desk</a></li>
<li><a href="#">Product</a></li>
</ul>
</li>
</ul>

</body>
</html>

miggsy007
10-28-2004, 10:17 AM
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replaceĽ
(" over", "");
}
}
}
}
}
window.onload=startList;
}


Isn't this JavaScript? Shouldn't it be in the JavaScript forum? And shouldn't it be inside <script> tags? And as another point, providing an address to a site with it running is better than posting huge amounts of code, especially when you haven't enclosed it in code tags.

Eskimo
10-28-2004, 11:38 PM
miggs007 is right, this:
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");

for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
}
node.onmouseout=function() {
this.className=this.className.replace(" over", "");
}
}
}
}
}
window.onload=startList;

Should be in a <script> tag.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum