I am building a site which swaps images using an onClick event. I was wondering if there’s a way to swap the alt tag along with the image.
What I am aiming to do is have a caption under an image, and swap that caption when the image is swapped. Here’s the code for my unsuccessful attempt:
<a href="#" onClick="document.imgbx.src='images/01.jpg';document.imgbx.alt='this is a test caption';"><img src="images/thumbs/01.jpg" border="0" /></a>
I was wondering if the alt attibute can be used the same way I’m using the document.imgbx.src attribute. If not, is there any workaround to this?
If I’m making things too complicated for myself, I would appreciate some other suggestions entirely.
You can see what I’m trying this out on here:
Thanks in advance,