View Full Version : Navigation not working in IE, or AOL


TanisLinkEragon
11-12-2006, 08:00 PM
Recently I discovered that my navigation menu doesn't work in Internet explorer, or AOL explorer (probably others too). The sub menus dont appear.

<script type="text/javascript">
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;
</script>
<style type="text/css">
ul {
margin: 0;
padding: 27px;
list-style: none;
width: 120px;
}
ul li {
position: relative;
}
li ul {
position: absolute;
left: 119px;
top: 0;
display: none;
}
ul li a {
display: block;
text-decoration: none;
color: #777;
background: #00035E;
padding: 3px;
border: 1px solid #ccc;
border-bottom: 1px solid #ccc;
}
/* Fix IE. Hide from IE Mac \*/
* html ul li { float: left; }
* html ul li a { height: 1%; }
/* End */
li:hover ul { display: block; }
</style>
<ul id="nav">
<li><a href="http://www.habbground.com" style="border-left: 1px solid black">Home</a></li>
<li><a href="#">Hotel News</a>
<ul>
<li><a href="http://www.habbground.com/news/usanews.php">USA (.com)</a></li>
<li><a href="http://www.habbground.com/news/usanews.php">UK (.co.uk)</a></li>
<li><a href="http://www.habbground.com/news/usanews.php">AU (.au)</a></li>
<li><a href="http://www.habbground.com/news/usanews.php">CA (.ca)</a></li>
<li><a href="http://www.habbground.com/news/sportsnews.php">Sports</a></li>
</ul>
</li>
<li><a href="#">Media</a>
<ul>
<li><a href="http://habbground.listen2myradio.com/">Radio</a></li>
<li><a href="#">Podcast (coming soon)</a></li>
<li><a href="#">Alterations (coming soon)</a></li>
</ul>
</li>
<li><a href="#">Fun Stuff</a>
<ul>
<li><a href="http://www.habbground.com/Forums">Forums</a></li>
<li><a href="http://www.habbground.com/chat">Chat (coming soon)</a></li>
<li><a href="http://www.habbground.com/Rarevalues">RareValues</a></li>
<li><a href="http://www.habbground.com/pandacam.php">PandaCam</a></li>
</ul>
</li>
<li><a href="#">Staff</a>
<ul>
<li><a href="http://www.habbground.com/staff.php">Staff list</a></li>
<li><a href="http://www.habbground.com/joblist.php">Available jobs</a></li>
<li><a href="http://www.habbground.com/app.php">Job Application</a></li>
<li><a href="http://order.1and1.com/xml/deref?link=http%3A%2F%2Fwebmail.1and1.com&sign=c6cce7de0685562d78e419f029176448">Staff Email Login</a></li>
<li><a href="http://www.habbground.com/Rarevalues/reporter/reporter.php">RareValues Reporter Login</a></li>
<li><a href="http://www.habbground.com/news/cutenews/">Reporter/Editor Login</a></li>
<li><a href="http://www.habbground.com/admin">Admin Area</a></li>
</ul>
</li>
</ul>


can anyone figure out whats wrong?

Oh, and can anyone figure out why theres an annoying black bar in the upper left? <a href="http://www.habbground.com">linky</a>

also, how can I keep it at the top of the page, so it doesnt center itself?

bejayel
11-14-2006, 02:28 AM
That script shouldent work in any browser. Your problem lies in the if statement:

if(document.all&&document.getElementByID)

Following the DOM, Internet explorer does not use getElementByID, it uses document.all, and does not use both, and so if one of them fails, so does the script.


startList = function()
{
if (document.getElementById)
{
navRoot = document.getElementById("nav");
}
else if(document.all)
{
navRoot = document.all("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", "");
}
}
}
}


Also, you really should try to make neater code.

And testing the above, i dont think it works. I was unaware of this

something=function();

call that you are making. Are you sure you are doing this properly?

Also, if i remeber correctly AOL uses either the IE6 rendering engine, or the Gecko engine. Since mozilla was tied with aol, and used Gecko, i cant remeber if the AOL browser itself used Geecko or IE6

TanisLinkEragon
11-14-2006, 07:32 PM
Hmm.... It works in firefox...

anyways, do you have any ideas on how to make it work?

And by the way, I didn't make that script ;)

bejayel
11-15-2006, 03:52 PM
oic. Well thats bad. It seems like ther eis a lot of code mising though. That alone couldent possible make a login script. I dont think anyway.

Eitherway, it looks like that script was designed specifically for firefox. I cant wait till W3C hacks away at javascript and give web companies some standards to follow. Right now javascript gives everyonea hard time.

Anyway, it looks to me like that isnt all the code that shoud be there. Is ther a js file somewhere or something, or is that it??

TanisLinkEragon
11-15-2006, 07:40 PM
Nope thats it... and its not a login script, its a navigation menu script ;)

On a side note, that link wont work anymore, as I've taken down the script in question.