MR. Ask said:
Sat, 19 Feb 2005 14:12:07 -0000, na comp.lang.javascript, Richard Cornford
napisa³(a):
Sorry for my English. I ask because I want to create web pages with some
pictures and I don't want this pictures load all the times. I would use
this pictures as menu. I observed that in many pages these functions are
used and I wanted to do the same.
The functions that you are referring to (that start with MM_) are a
product of Macromedia's (failed) attempt to write a "standard" function
that works in most (if not all) cases. Thats impossible to do. The best
script you can write is very specific to a particular page. If all you
want is a simple image rollover, it is done a lot simpler, and more
efficient, than the MM_ functions.
<img src="someImage.jpg" name="myImage" width="XX" height="XX" alt="XXXX">
function swapImages(imageName,newSource){
if (document.images && document.images[imageName]){
document.images[imageName].src = newSource;
}
else{return false;}
}
And you call it something like this:
onmouseover="swapImages('myImage','newImageNameHere')
onmouseout=""swapImages('myImage','oldImageNameHere')
<FAQENTRY>
Is there a notes section that deals with image swaps? I know 4.31
addresses why rollovers are slow but I do not see anything in the FAQ
itself that addresses how to do an image swap.
</FAQENTRY>
When replying to this message, please make Richard's life simpler and
modify the FA*ENTRY tags above.