Hi
I have the following code for a dropdown menu that I am creating and the problem is that whilst the variables are being set correctly the for and if statement aren't functioning correctly.
Instead of allowing the dropdown menu to be activated onmouseover it flashes on/off briefly when the page is loaded and that's it.
Here is the code that I am working with:
[CODE=javascript]function gatherItems(c){
//alert("Function has been called and the id is: "+c);
container = document.getEle mentById(c);
items = container.getEl ementsByTagName ('a');
subs = container.getEl ementsByTagName ('div');
alert(items.len gth+" "+subs.leng th);
//alert(items.id) ;
for(var i=0;i<items.len gth;i++){
if(items[i].id){
items[i].onmouseover = show(items[i].id);
items[i].onmouseout = delay();
}
}
/*for(var s=0;s<subs.leng th;s++){
if(subs[s].id){
subs[s].onmouseover = canceldelay();
subs[s].onmouseout = delay();
}
}*/
}[/CODE]
Note: The functions being called onmouseover and onmouseout are working fine without this piece of code.
I have the following code for a dropdown menu that I am creating and the problem is that whilst the variables are being set correctly the for and if statement aren't functioning correctly.
Instead of allowing the dropdown menu to be activated onmouseover it flashes on/off briefly when the page is loaded and that's it.
Here is the code that I am working with:
[CODE=javascript]function gatherItems(c){
//alert("Function has been called and the id is: "+c);
container = document.getEle mentById(c);
items = container.getEl ementsByTagName ('a');
subs = container.getEl ementsByTagName ('div');
alert(items.len gth+" "+subs.leng th);
//alert(items.id) ;
for(var i=0;i<items.len gth;i++){
if(items[i].id){
items[i].onmouseover = show(items[i].id);
items[i].onmouseout = delay();
}
}
/*for(var s=0;s<subs.leng th;s++){
if(subs[s].id){
subs[s].onmouseover = canceldelay();
subs[s].onmouseout = delay();
}
}*/
}[/CODE]
Note: The functions being called onmouseover and onmouseout are working fine without this piece of code.
Comment