Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Problems with addEvent in IE7
January 16, 2008, 3:46 am
rate this thread
I'm doing an image slide show on a web site:
I use a tool called smooth gallery (http://smoothgallery.jondesign.net /
showcase/manual-slideshow/) that uses Mootools itself.
However, I don't want the arrows inside the image box, I want the user
to be able to click on arrows that are pictures outside the box.
The code that handles the click on the original version is as follow:
var leftArrow = new Element('a').addClass('left').addEvent(
var rightArrow = new Element('a').addClass('right').addEvent(
I changed the code to this:
var leftArrow = document.getElementById("flgauche").addEvent(
var rightArrow = document.getElementById("fldroit").addEvent(
Basically, I removed a call to the injectInside method that puts the
arrows inside the box and I used the same addEvent method but with my
already existing objects (flgauche and fldroit). It works fine in
Firefox, but doesn't work in IE6 nor 7. It tells me that the object
doesn't support the method.
My thinking is that the value of document.getElementById("flgauche")
doesn't support the addEvent method, but I'm puzzled as to how to do
it so it works fine.
Thanks in advance
Re: Problems with addEvent in IE7
that you're asking about. And I suspect that is the root cause of your
problem. Looking at the code, I can't tell WHAT addEvent() actually
does, since it's probably defined by the library you're using. You face
the same problem with injectInside. It looks to me like whoever build
the library you're using didn't fully test it on all browsers.
BTW, did you check Google?
If you read the first 4-5 results, you'll get a good education in the
problems you're facing.