image onload event

i used js image object to preload image, and on onload event to do something else. but for animate d gif this is an issue in IE 7, where onload event keep firing.

var image = new Image();
image.onload = somefunction;
image.src = someurl;

for ie 7, somefunction keeps firing for this animated gif. what to do to prevent this?

thanks
johndennyAsked:
Who is Participating?
 
Shinesh PremrajanConnect With a Mentor Technical ManagerCommented:
Could you provide whats there in the "somefunction". Just check that it has a return statement in the end of the function.
Hope this helps
0
 
Michel PlungjanIT ExpertCommented:
I bet it is setting the src to something else :)
0
 
Michel PlungjanConnect With a Mentor IT ExpertCommented:
So perhaps


function somefunction() {
  if (this.src.indexOf('firstImage')==-1) this.onload=null;
}
0
All Courses

From novice to tech pro — start learning today.