By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,253 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,253 IT Pros & Developers. It's quick & easy.

Thumbnail OnClick Display Enlarged Image in Same Window

P: 3
Hi I'm trying to put together an Image Gallery. Everytime you click on an image it opens a new browser window. I want the Enlarged Imge to open in the same window in a designated area ('Box2'). How can I make this work???

Here's the code:
Expand|Select|Wrap|Line Numbers
  1. </head>
  2. <logo />
  3. <body>
  4. <div id="container">
  5. <div id="Box1">
  6.   <p><button /></p>
  7.   <p><button /></p>
  8.   <p><button/> </p>
  9. </div>
  10. <div id="Box2"><img src="" alt="" name="PlaceHolder" width="500" height="333" id="PlaceHolder" /> </div>
  11. <div id="Box3">
  12.   <div align="center">
  13.     <p>&lt; </p>
  14.     </div>
  15. </div>
  16. <div id="Box4">
  17.   <a href="mg_site/images/large/1.gif" target="_blank"><img src="file:///Macintosh HD/Users/damianwilkinson/Desktop/mg_site/images/thumbnails/1th.gif" alt="1th" width="200" height="133" border="0" longdesc="mg_site/images/thumbnails/1th.gif" /></a>
  18.   <a href="mg_site/images/large/2.gif" target="_blank"><img src="file:///Macintosh HD/Users/damianwilkinson/Desktop/mg_site/images/thumbnails/2th.gif" alt="2th" width="200" height="133" border="0" longdesc="mg_site/images/thumbnails/2th.gif" /></a>
  19.   <a href="mg_site/images/large/3.gif" target="_blank"><img src="mg_site/images/thumbnails/3th.gif" alt="3th" width="200" height="133" border="0" longdesc="mg_site/images/large/3.gif" /></a>
  20.   <a href="mg_site/images/large/4.gif" target="_blank"><img src="file:///Macintosh HD/Users/damianwilkinson/Desktop/mg_site/images/thumbnails/4th.gif" alt="4th" width="200" height="133" border="0" longdesc="mg_site/images/thumbnails/4th.gif" /></a>
  21.   <a href="mg_site/images/large/5.gif" target="_blank"><img src="file:///Macintosh HD/Users/damianwilkinson/Desktop/mg_site/images/thumbnails/5th.gif" alt="5th" width="200" height="133" border="0" longdesc="mg_site/images/thumbnails/5th.gif" /></a></p>
  22. </div>
  23. <div id="Box5">
  24.   <div align="center">
  25.     <p>&gt; </p>
  26.     </div>
  27. </div>
  28. </div>
  29. </div>
  30.  
  31. </body>
  32. </html>
  33.  
Feb 12 '10 #1
Share this Question
Share on Google+
5 Replies


Markus
Expert 5K+
P: 6,050
Change those target attributes to target="_parent"
Feb 12 '10 #2

P: 3
I've tried and It does open in that same window but it's just the image, I want the whole site to be viewed at the same time.
Feb 12 '10 #3

Markus
Expert 5K+
P: 6,050
Sorry, I misread. You'll need to use javascript. I'll move the question over there.
Feb 12 '10 #4

P: 3
Thanks, I really have no idea what I'm doing.
Feb 12 '10 #5

gits
Expert Mod 5K+
P: 5,390
use an onclick handler that sets the src-attribute of the img in the box2 div. you might give the image an id and then use:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('imgId').src = "yourImageSrc';
kind regards
Feb 13 '10 #6

Post your reply

Sign in to post your reply or Sign up for a free account.