im trying to run a script that runs in every browser except IE (IE 7)
this is part of the script:
function menuInteract()
{
var listLines = document.getElementsByTagName(“li”);
alert(listLines.length);
for (var i=0; i<listLines.length; i++){
attachEventListener(listLines[i], “mouseover”, rollOver, false);
attachEventListener(listLines[i], “mouseout”, rollOut, false);
}
}
the alert was to find why is not working.
On every other browser the alert(listLines.length) give me the number “16” that is the number of ‘li’ tags but in IE7 gives me [object] so as soon i get in the ‘for’ the scrip stop in IE.
Is this a bug or is there something that is missing in my code?
In the advanced editing there is a syntax dropdown box you can choose from.
Normally you wrap the code with a highlight statement, where at the start of the code you place highlight=“javascript” inside square brackets, and at the end you place /highlight in square brackets.
Do you have anything else on the page that could be interfering with IE, such as a form element called length? A look at the offending page would do wonders towards helping you out.
well at the moment im testing a beaviour in a navigation menu
so I cuted the all <ul> wraped with a div and that is all my html, so no I dont have any form there
but the situation here dont make sense because result of the array with all li’s tags in every browser is the same except in IE
var listLines = document.getElementsByTagName("li");
alert(listLines.length);
this alert gives the same number (on this case 16) in every browser except in IE (IE7) that give this info: ‘[object]’
So when it goes to the for
for (var i=0; i<listLines.length; i++)
it make sense to break because IE cant count it, it return ‘[object]’ from the listLines.length
So just can be from the geElementsByTagName in my IE.
the question is: Is there a bug or its my IE that is jammed?