http://javascript.internet.com/image…e-gallery.html
I copied the example above but when I click on the smaller image to load the larger one it works for a fraction of a second (I can see the image load in the right spot), but then the browser goes to the URL of the image instead (showing it on a blank page).
See what I mean here:
http://www.keeneysandandstone.com/boulders-js.html
Clickin on one of the smaller boulder images is supposed to load the larger version of that image below.
Related code:
imageGallery.js
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Jeremy Keith / Anonymous | http://www.alistapart.com/articles/imagegallery/ */
function showPic(whichpic) {
if (document.getElementById) {
document.getElementById(‘placeholder’).src = whichpic.href;
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;
}
}
HTML
Head:
<script type="text/javascript" src="imageGallery.js"></script>
Body:
<table width="900" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%" align="center"><a onclick="showPic(this); return false;" href="images/boulder1.jpg" /><img src="images/boulder1-thumb.jpg" width="197" height="125" /></a></td>
<td width="25%" align="center"><a onclick="showPic(this); return false;" href="images/boulder2.jpg" /><img src="images/boulder2-thumb.jpg" width="197" height="125" /></a></td>
<td width="25%" align="center"><a onclick="showPic(this); return false;" href="images/boulder3.jpg" /><img src="images/boulder3-thumb.jpg" width="197" height="125" /></a></td>
<td width="25%" align="center"><a onclick="showPic(this); return false;" href="images/boulder4.jpg" /><img src="images/boulder4-thumb.jpg" width="197" height="125" /></a></td>
</tr>
</table>
…
Where the image should load:
<img id="placeholder" src="images/boulder1.jpg">
Any help appreciated. I’m not a programmer, just a designer, and this has stumped me.
Thanks!
Similar:
- image onclick event <asp:GridView ID="gvOfferedProductDetails" runat="server" AutoGenerateColumns="false" Width="500" HeaderStyle-CssClass="tableHead" OnRowDataBound="gvOfferedProductDetails_RowDataBound"> ...
- Change background image and div content with ajax Hi All hope you can help its been driving me crazy .. i have a website where i change the content of a div using...
- How do I pass the file names (from child window) back to an html page (parent window)? I have an html (not aspx) page which opens up a pop-up window (Child.aspx page) to upload files. I have everything working but don't know...
- how to fix the window size even image position outside the box? http://img227.imageshack.us/img227/3553/whitespace.png http://img704.imageshack.us/img704/4586/leftii.png I'm developing a website. I've position some image using CSS. i've set the background to 100% but when my the image i position...
- rollover image swap function Hey Everyone, I am trying to write a simple function that will apply a rollover function to certain images. It seems that the onmouseover and...
Tags: blank page, boulders, childnodes, desc, fraction, image gallery, image load, imagegallery, images, javascript source, placeholder, title document
[...] Image Swap onClick Opens Image in Parent Window | The Largest … [...]
[...] Image Swap onClick Opens Image іח Parent Window | Tһе Lаrɡеѕt… [...]
[...] Image Swap onClick Opens Image in Parent Window | The Largest … [...]
[...] Image Swap onClick Opens Image in Parent Window | The Largest … [...]
[...] Image Swap onClick Opens Image іח Parent Window | Tһе Lаrɡеѕt… [...]
[...] Image Swap onClick Opens Image in Parent Window | The Largest … [...]
[...] Image Swap onClick Opens Image in Parent Window | The Largest … [...]
[...] Image Swap onClick Opens Image in Parent Window | The Largest … [...]
[...] Image Swap onClick Opens Image in Parent Window | The Largest … [...]