File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes javascript image pop up Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript image pop up" Watch "javascript image pop up" New topic

javascript image pop up

Ferry Lukito

Joined: Dec 13, 2004
Posts: 8
hi guys, I'm a newbie in javasript and would like to get some help. I need a javascript that allows me to view image in a pop up window. I have a main window that has all the thumbnail of the pictures. When users click on any of the pictures, there will be a pop up window appears, with the enlarged picture of the selected picture and I would also like to allow user to click on "Next" and "Back" button on the pop up window to browse through the next and previous button. Anyone can help me on this? Thanks b4...
Bajji Pat
Ranch Hand

Joined: Apr 05, 2005
Posts: 50

The following code works fine in I.E (plz test in whatever browser u need to support)

function opnImg(imgname)
// Since the WINDOW NAME is the same
// Each picture would open in the same window
// Hence the back and forward button can be used(unless the window
// is closed each time),"WINDOWNAME");

Have your thumbnail pictures in the "body" tag
use the onclick attribute as below :
Use the following attribute in your "img" tag

"onClick" attributes value -javascript pnImg('yourimagename.jpg');

Hope this helps
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
There a bunch of slideshows here that you may find useful.

Ferry Lukito

Joined: Dec 13, 2004
Posts: 8
Yeah, the suggestion works well. Thanks.
I agree. Here's the link:
subject: javascript image pop up
It's not a secret anymore!