Rupe wrote:
Quote:
my solution actually got it to work by using an intermediary function
and the event object. But I don't think it's ideal
Far from it.
Quote:
>
function myEvent(evt){
if(evt.type=="mouseover")
imageOn(evt.srcElement.id);
else
imageOff(evt.srcElement.id);
}
>
function imageOn(imgName) {
if (document.images) {
if(isIE){
Browser detection went out of fashion a long time ago, use feature
detection or a different scheme to link the elements.
Quote:
document.all[imgName].src = onImgArray[imgName].src;
}
else
document.images[imgName].src = onImgArray[imgName].src;
There appear to be some braces missing here.
Quote:
}
}
>
two functions to run what should simply be one, is pretty ordinary,
but it got the job done.
It seems you have either an element with an ID that is the same as some
other element's name property or you are using an element reference to
get its id to get a reference back to the same element. Both are poor
design decisions - the first is worse than the second.
You should be aware that evt.srcElement will not work in browsers that
do not support IE's proprietary event model - the W3C equivalent is
event.target.
Also, the element referenced by event.target may be a text node and
therefore may not have an ID attribute, or at least not the one you are
after.
If you explain a bit more about what you are trying to do, you'll get
better help.
--
Rob