View Full Version : problem with addEventListener

11-12-2002, 08:54 PM
I think...

Here's my page (http://www.lanwizards.com/navtest/test.htm) and you can go here (http://www.lanwizards.com/navtest/showsrc.php) to view the source and js.

Now, the problem? Well, for some reason, it doesn't seem like the event is being attached, because it never fires...

Any clues? Did I misspell somthing? :rolleyes:

11-13-2002, 01:15 AM
hmm... that DOM browser looks familiar.....

11-13-2002, 01:37 AM
function toggleDisp(subHead, subMenu)
if (is.ie)And what if not???
if ((is.ie && subMenu.currentStyle.display == 'none') || (is.gecko && (subMenu.style.display == 'none' || subMenu.style.display == ''))) {
subMenu.style.display = 'block';
subHead.style.listStyleImage = "url(../images/nav_arrow_dn.gif)";
subHead.setAttribute("title","Click to hide");
else {
subMenu.style.display = 'none';
subHead.style.listStyleImage = "url(../images/nav_arrow.gif)";
subHead.setAttribute("title","Click to expand");

11-13-2002, 02:15 AM

Thanks :rolleyes:

11-13-2002, 02:25 AM
Oh, I almost forgot. Total homage to your DOM browser. It is one of my favorite tools.


hehe :D

11-13-2002, 04:42 PM
Well, just FYI for Vladdy and those that observe....although the line Vladdy indicated to me certainly would cause a problem, there was a mixup someplace else. The problem was related to the fact the Gecko includes many textNodes that IE doesn't, and more importantly, that Gecko will register events fired from a textNode. I had to add the red-line below to circumvent this.
function toggleMenu(e) {
if (is.ie) e = window.event;
e.cancelBubble = true;
var li = (is.ie) ? e.srcElement : e.target;
if (li.nodeType == 3) li = li.parentNode;
var ul = getSubMenu(li);
toggleDisp(li, ul);