hi there, i am a novice at this and have copied and pasted code to try and acheive what i need but am having trouble. I have two functions, one to show random ads but the second is to show the "ads" in a larger image in a different place when mouseover. Although this code works i now want to adapt it to show a slightly different picture. Here is the code i am using and a presume the problem lies with the showIt(this.src) as i dont want it to show the same picture. Any help would be great. Thank you
here is the script i am using
var holder = document.getElementById('imageshow');
var newpic= new Image();
if it helps here is the full code, its confusing me due to the random ads section being very important too:
That was all understood initially, but to make the task easier there should be a relationship between the corresponding file names, like 1.jpg and 1_big.jpg etc, in which case you could use:
thank you very kindly to both of you as this appears to work perfectly, sorry for the long winded understanding from my end, The 'simple' option does what i need but in future there will be hundreds of pictures and if you have the time i would be grateful of an easier option to run this script. Basicalli what i have got does what i want ie, randomise a collection of images then upon mouseover show a related but different image in a seperate location.
As i said before your solutions work and i am very grateful for your help, but i am always looking for an easier and better option for future as the site develops and increases in size
Well, actually, this simple way might be the best idea if you have hundreds of pictures.
First of all, if you had 100 small thumbnails then you really *SHOULD* create small thumbnail images!! If the actual images on disk are big--100KB or larger--and yet they are displayed in a 100x100 spot in the browser, you are making the user's browser download *ALL* those large images (10MB or more!!) when you could have gotten away with may a tenth or twentieth the download. People will get mad at you for making them wait forever for a bunch of tiny images.
Anyway, if you also have 100 separate large images, the same problem attains. Until all 100 of those large images are sent from the server to the browser, you'll have to wait for the image before it will show.
If you can live with the delays, though, then the simple code we have shown you works just fine.
In general, any time you start talking "hundreds of images" for a web page, *some place* you are going to pay the price, in terms of download time.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.