Onhover text replace
My function so far:
<a onMouseOver="update('images/educational/img1-large.jpg', 0, false); return false;">
Large image div:
<img src="images/educational/img3-large.jpg" name="PhotoBig">
<div id="caption">WANT CAPTION TO GO HERE</div>
Any help appreciated!
notice that in this sample i create an array that contain a string. each entry is composed of the image url separated with a comma and a white space followed by the caption. i would prefer this approach, so you don't have to go different part of the document when you want to update which image to show. if you want to change an image position on the array, you simply move the line img.push(...) to the desired position.
var img = ;
img.push('images/educational/img3-large.jpg, caption for this image');
img.push('images/educational/img2-large.jpg, caption for this image');
img.push('images/educational/img4-large.jpg, caption for this image');
document.getElementById('caption').innerHTML = img[which].split(', ');
the HTML is:
A follow up:
However, I can't put any commas in the caption area as it stops the text
This is a, test
This is a
How can I encode commas so it doesn't assume that it's reached the end of the statement prematurely.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)