Javascript image src change handler.
Posted: Mon Feb 12, 2007 2:42 pm
What event is used when an image's source is changed??? I need to bind a handle to an event that executes every time the user changes the source.
I could use onload, but then the event wouldn't fire till the image is fully loaded, which I need it to fire as soon as the source is changed.
Is there a way to add an event to a object property like imgelement.src? I tried:
But then I get an Error in IE saying:
Please help me on this one. Thanks.
I could use onload, but then the event wouldn't fire till the image is fully loaded, which I need it to fire as soon as the source is changed.
Is there a way to add an event to a object property like imgelement.src? I tried:
Code: Select all
this.watch("src", function() {
alert("source changed!");
});
I'm assuming that the property or method it's referring to is the watch method. Well then what object does support this method? Or is it that IE doesn't support this method at all?Object doesn't support this property or method.
Please help me on this one. Thanks.