PDA

View Full Version : Please HELP


Adam555
10-12-2002, 08:17 AM
Hi, I found this great script on the web for mouse-over slide show, and it works fine, however I have one problem, probably simple, but for me vey big :-(( that I hope someone migh help me to solve. The problem is as follow: in this script, as it is now, all other images are loading distorted if they are not exactly the same width and hight as the first picture.

Can somebode help me and show how to modify the original script so images don't have to be exactly the same size? Please....:-)
Regards, Adam
adammodes@hotmail.com


</script>
<script language="JavaScript1.1">
var myimages=new Array()
var gotolink="#"

function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image()
myimages[i].src=preloadimages.arguments[i]
}
}


preloadimages("plane1.gif","plane2.gif","plane3.gif","plane4.gif","plane5.gif")
</script>




<a href="javascript:warp()"><img src="plane0.gif" name="targetimage" border=0></a>

Below onMouseover event handler should be inside the <a> tag of these links, like below:

<a href="b2.htm" onMouseover="changeimage(myimages[0],this.href)">Plane 1</a>

where "0" inside the variable myimages[0] indicates that when the mouse moves over this link,

the rollover image should be substituted with the first image defined in the function

preloadimages() of Step 1. For each link, you'll need to change "0" to another integer, with

the integer representing the position of the image you wish the rollover image to change to,

again, as defined in function preloadimages().

Mr J
10-12-2002, 01:25 PM
Where's the rest of the script?

What you have shown is the preloader.

:confused:
:(
;)
:eek:
:o
:)
:D
:mad:
:thumbsup:

adios
10-12-2002, 06:02 PM
First: please don't post an eMail address - this is a forum, it's public, that's the whole point.

The problem you describe is almost always caused by defining a width & height in the <img> tag. If you did, remove it, and the image will resize for proper display - in most browsers. If there's other content on the page, and you don't want it to 'jump' down when a larger image is swapped in, you can put the <img> tag in a table cell with hardcoded dimensions equal to the largest image in the set.