I've come across a snippet of JavaScript that rotates images randomly. I've tried to modify it so that when I rollover it a mouse over image is shown as well as have a link to another page, but Im not to sure what I'm doing.
The original code was:
[CODE=javascript] random_num = (Math.round(Mat h.random()*9));
document.write( "<img src='_random/image_" + random_num + ".jpg' width='91' height='113' hspace='0' vspace='0' border='0'><br />" );[/CODE]
I've modified it to:
[CODE=javascript] random_num = (Math.round(Mat h.random()*9));
document.write( "<img src='_random/image_" + random_num + ".jpg'
width='91' height='113' hspace='0' vspace='0' border='0' </br>
onmouseover=\"t his.src='_rando m/image_over_" + random_num + ".jpg'\"</br>" );[/CODE]
but then nothing is showing at all. Also I have no idea how to add links so that a different link is active depending on which image is visible
Thanks
The original code was:
[CODE=javascript] random_num = (Math.round(Mat h.random()*9));
document.write( "<img src='_random/image_" + random_num + ".jpg' width='91' height='113' hspace='0' vspace='0' border='0'><br />" );[/CODE]
I've modified it to:
[CODE=javascript] random_num = (Math.round(Mat h.random()*9));
document.write( "<img src='_random/image_" + random_num + ".jpg'
width='91' height='113' hspace='0' vspace='0' border='0' </br>
onmouseover=\"t his.src='_rando m/image_over_" + random_num + ".jpg'\"</br>" );[/CODE]
but then nothing is showing at all. Also I have no idea how to add links so that a different link is active depending on which image is visible
Thanks
Comment