PDA

View Full Version : IE DOM Dumb


meth
04-11-2006, 07:34 PM
I'm looking for a dhtml guru to help me find Waldo in IE. Waldo can be seen on this page (http://202.60.81.120/~sthcpec/template_02.php). When you mouseover the product and recipe link, the css menu works.

However Waldo disappears when the menu is dynamically populated (http://bauer.jumba.net.au/~sthcpec/). Me thinks the structure of the nested list scares Waldo away.

Both pages use the same CSS and same JS function to operate the menus but the dynamic menu doesn't work in IE.

The JS function is:



activateMenu = function(nav) {
var avtivated = 0;
var totLIUL = 0;
var overApplied = 0;
var outApplied = 0;
/* currentStyle restricts the Javascript to IE only */
if (document.all && document.getElementById(nav).currentStyle) {
var navroot = document.getElementById(nav);
var activated = 1;
/* Get all the list items within the menu */
var lis=navroot.getElementsByTagName("LI");
for (i=0; i<lis.length; i++) {
/* If the LI has another menu level */
if(lis[i].lastChild.tagName=="UL"){
totLIUL++;
/* assign the function to the LI */
lis[i].onmouseover = function() {
/* display the inner menu */
this.lastChild.style.display="block";
this.lastChild.style.sIndex="100";
overApplied++;
}//mouseover
lis[i].onmouseout=function() {
this.lastChild.style.display="none";
outApplied++;
}// mouse out
}// if li has nested ul
}// for loop
//debugging
if(activated == 1){
alert ('Nav Activated :: ' +'Nested UL\'s Found = ' + totLIUL + ' :: ' + 'Fn mouseover applied = ' + overApplied + ' :: Fn mouseout applied = ' + outApplied);
}
}// if ie
}// activate function



This is the debug version. The alert message says the function runs OK, it finds all the nested UL's OK, but it can't apply the mouse event functions with "this.lastChild.style.display".

Where's Waldo?

Basscyst
04-11-2006, 09:49 PM
I've found Waldo!! Well, he's not on your site, but at least we've tracked him down. I'll talk with him, see if I can't get him to stop bye.

Here ya go.

http://www.lavidadelosgorilas.org/archives/images/waldo.gif

Oh and. . .

http://www.catb.org/~esr/faqs/smart-questions.html

Basscyst

meth
04-11-2006, 10:07 PM
Basscyst - you allergic to humor? In some places, 'waldo' is used in place of foobar as a nonsense word. Since this bug makes no sense, a nonsense word fits nicely.

Basscyst
04-11-2006, 10:16 PM
Judging by my response you could assume no, I'm not allergic to humor. I will say though that when you are trying to ask a question of a technical nature it's best to be clear and to the point. Otherwise many will ignore the seriousness of your post and merley carry on with the humor. So really you could say, "I'm easily distracted from serious questions, by humor". I found that article to be a good read, which is why I linked it. I found I myself make, or have made, many of the mistakes mentioned. If you read it, perhaps you will be enlightened as well.

Basscyst

meth
04-11-2006, 10:47 PM
Your link to the posting guidelines reads like a conformist's bible. The added humor doesn't detract the conciseness of the post and anyone who cares to carry on the humor is quite qelcome to in my books. Too much technical reading becomes a chore.

At any rate, the problem was with the html comments inserted before each li in the parent ul. This was throwing out the DOM for which the mouse event functions were applied. Waldo was hiding beind the html comments. Without the comments, IE happily produced the submenus.

Basscyst
04-11-2006, 11:27 PM
It's not our posting guidlines, just some guidlines I read and found informative, you can take it or leave it. I'm glad you found the solution to your issue. Do note though, that many people reading these boards may not share the same language as you. They may be quite knowledgable and be able to assist you if they can understand the question. Adding in humor in the fashion that you did only helps to confuse the matter. I know who waldo is and what it means, and when I first read the question, I was like WTF is this guy talking about, but I digress, I think I'm starting to sound like a lecturer. :p

On a more directly helpful note, you may look into the method "getComputedStyle" (the Moz / ff equivelent to currentStyle) to get that script working in some other browsers. Perhaps though you left the other portion of the script out since it was working properly?

Basscyst