Entry
Why doesn't onClick work when loading an image like a rollover on Netscape mac????
Jun 6th, 2001 21:41
Colin Fraser, Dave Pedowitz,
Without seeing the code it is a little difficult to make any sort of
reasonable assessment of the problem. However, if you preload images
used in rollovers then they will work as they should in NN for the Mac.
Try :
//This script preloads images into the cache on opening the document.
if (document.images) {
alias1 = new Image
alias2 = new Image
alias1.src="mypic1.gif"
alias2.src="mypic2.gif"
} //end if
//This function changes over images on all rollovers in the document
function chgImage (imgName,newImg ) {
if (document.images) {
document[imgName].src=eval(newImg+".src")
} //end if
} //end function
The above code is placed into the remote *.js file
To call the rollover in the page
<a href="mypage.html"
onMouseOver="chgImage('pic0','alias2')"
onMouseOut="chgImage('pic0','alias1')">
<IMG SRC="mypic1.gif" BORDER=0 NAME="pic0" ALT="Alternate Topic"></a>
Hope this is what you were looking for.