View Full Version : click() for non-input elements in NS
beetle
11-13-2002, 06:36 PM
In IE the click() method works on anything, but with Gecko it only works on elements specified in the standard (http://www.w3.org/TR/2000/WD-DOM-Level-2-HTML-20001113/html.html#ID-2651361)
I need to enact a click() on an LI element in Gecko.
What is it? I'll look after my lunch break, but if anyone knows I'd appreciate it...
Amazing what the search function turns up ;):
http://www.codingforums.com/showthread.php?s=&threadid=7495&highlight=click
:)
beetle
11-13-2002, 07:24 PM
ya, but searching for "click" returns MANY results, since this forum doesn't accept parentheses for search keywords. Besides, didn't I indicate I hadn't looked yet? :D
Thanks, I'll use (and remember) this. :)
This was the 3rd result I had, but that may have been because I remembered having written this before, and only searched for threads I had posted in. :D
beetle
11-13-2002, 11:27 PM
Hey jkd, thanks for all your help. If I can ask one more thing of you. I'm 99% done with this menu thingy I'm making...some somehow someplace somewhere in my code something happens that prevents the regular links (anchors) from activating in Gecko. Since you're the resident Gecko proponent, hopefully your eyes can see what my script is doing to cause this.
The page is here (http://www.lanwizards.com/navtest/test.htm) and the source code is here (http://www.lanwizards.com/navtest/showsrc.php). I realize it's a bit of stuff to wade through, but any help would be appreciated.
joh6nn
11-14-2002, 12:51 AM
well, if you're using the code that jkd posted in that other post, iirc, then it created a click() method for all HTMLElements, right? so wouldn't it be overwriting the click() method for links? i don't know if that would be the problem or not, but it's a place to start looking, maybe.
Originally posted by joh6nn
so wouldn't it be overwriting the click() method for links?
Yes, but that isn't a problem. The native browser click() method will be replaced by my own, which still performs the same action on a link.
Dispatching events work as if the user had done it - I've been able to modify textarea's by dispatching MutationEvents to it. :D
joh6nn
11-14-2002, 03:03 AM
the error message i get in Moz says that at line 81, f has no properties. that leads me to this:
// Finds UL node (submenu) to LI (header)
function getSubMenu(o) {
f = o.firstChild;
while (f.nodeName != "UL")
f = f.nextSibling;
return f;
}
now, i don't play with the dom all that much, so nodeName and nextSibling don't mean much to me, but i'll bet you that o.firstChild is not what you think it is in this particular case.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.