M
matt
Hi everyone,
I'm not really a developer but I've been trying to make a very simple
drop-down menu with JavaScript for a site I'm putting together.
Everything works fine on the page, but the Firefox developer's toolbar
I've got installed gives me this error:
"this.getElementsByTagName("ul")[0] has no properties"
Again, the menu works like it's supposed to, but this error is bugging
me. Here's the code:
function change() {
for (i=0; i<=10; i++) {
var sm=document.getElementById('submenu'+i)
if (sm)
{sm.style.display='none';}
}
for (i=0; i<=10; i++) {
var
dropmenu=document.getElementById('nav').getElementsByTagName('li');
dropmenu.onmouseover=function () {this.getElementsByTagName('ul')
[0].style.display='block';}
dropmenu.onmouseout=function () {this.getElementsByTagName('ul')
[0].style.display='none';}
}
}
window.onload=change;
And here's a link to the menus in action:
http://www.eagle1.american.edu/~wh9012a/menu/drop-down-menu.html
Any and all suggestions will be appreciated!
I'm not really a developer but I've been trying to make a very simple
drop-down menu with JavaScript for a site I'm putting together.
Everything works fine on the page, but the Firefox developer's toolbar
I've got installed gives me this error:
"this.getElementsByTagName("ul")[0] has no properties"
Again, the menu works like it's supposed to, but this error is bugging
me. Here's the code:
function change() {
for (i=0; i<=10; i++) {
var sm=document.getElementById('submenu'+i)
if (sm)
{sm.style.display='none';}
}
for (i=0; i<=10; i++) {
var
dropmenu=document.getElementById('nav').getElementsByTagName('li');
dropmenu.onmouseover=function () {this.getElementsByTagName('ul')
[0].style.display='block';}
dropmenu.onmouseout=function () {this.getElementsByTagName('ul')
[0].style.display='none';}
}
}
window.onload=change;
And here's a link to the menus in action:
http://www.eagle1.american.edu/~wh9012a/menu/drop-down-menu.html
Any and all suggestions will be appreciated!