Quote:
Originally Posted by theFez
first of all, this is a javascript question, not a java question. the only similarity between the two is that the latter is a proper subset of the former in name only.
Basically what you need to do is name your large image, then change your onclick to swap the images. so if you change this:
Code:
<img src='imgs/rail_def.jpg'>
to
Code:
<img src='imgs/rail_def.jpg' name='master'>
Now you have named the master image and can use javascript to alter this image. so your tnail links will change to
Code:
<a href="#" onClick="document.master.src='imgs/rail1.gif';" class="popimage"><img src='imgs/thumbs/rail1.jpg' class='popimage'></a>
|
theFez, I tried this this afternoon and keep getting parse errors. I thought I'd give your code a go since the code I've been trying to use has been giving me a problem (see above)
I used
Code:
<img src='imgs/rail_def.jpg' name='master'>
as the dynamic image in the right column
Then I used the following in the php thumb gallery code:
Code:
<a href="#" onClick="document.master.src='imgs/<?php echo $file;?>';" class="popimage"> <? echo "<img src='imgs/thumbs/$file' class='popimage'></a>
No function script in the page header (you didn't mention one). Am I wrong in thinking that the function of document.master needs to be defined so that onclick knows to swap the image with the clicked image in the generated code?
The page with your suggestion is here
http://www.arch13.com/galtest4.php
As for the code I've been trying mentioned above,
I finally figured that I can remove
Code:
if (whichpic.title) {
document.getElementById('desc')
.childNodes[0].nodeValue = whichpic.title;
} else {
document.getElementById('desc')
.childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
}
return false;
} else {
return true;
from it to get rid of the code pertaining to titles.
Unfortunatly, I still can't get it to work correctly. It still just loads the clicked image in the browser window instead of swapping it into the table. Could it be becuase the onclick link and placeholder image are seperated by a TD and that is breaking the code?