Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


javascript photo gallery script

javascript photo gallery script

javascript photo gallery script

I wonder if I could get a helping hand with this particular js code that I need for my portfolio gallery?

What I need is after the thumbnail is clicked and the larger image appears, the larger image would include a link at the bottom of the image that would take the viewer to a .pdf file.

Below is the script that I would like to use if possible. If there is any way I can tweak it to do what I need?

<script language="Javascript" type="text/javascript" src="script.js">

window.onload = initAll;

function initAll()
for(i=0; i<document.links.length; i++)
if(document.links[i].className == "newWin")
document.links[i].onclick = myNewWindow;

function myNewWindow()
var littleWindow = window.open(this.href, "ltWin", "toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,width=600px,height=600px,left=300px,top=300px");
return false;
<a href="index.html"><img src="home.jpg" alt="home"></a>
<a href="imgbears.jpg" class="newWin"><img src="thimgbears.jpg" alt="picture of bears"></a>
<a href="imgcats.jpg" class="newWin"><img src="thimgcats.jpg" alt="picture of cat"></a>
<a href="imgcheetah.jpg" class="newWin"><img src="thimgcheetah.jpg" alt="picture of cheetah"></a>
<a href="imgdunes.jpg" class="newWin"><img src="thimgdunes.jpg" alt="picture of dunes"></a>
<a href="imggallaxy.jpg" class="newWin"><img src="thimggallaxy.jpg" alt="picture of gallaxy"></a>
<a href="imgjet.jpg" class="newWin"><img src="thimgjet.jpg" alt="picture of jet"></a>
<a href="imgnavy.jpg" class="newWin"><img src="thimgnavy.jpg" alt="picture of navy boat"></a>
<a href="imgocean.jpg" class="newWin"><img src="thimgocean.jpg" alt="picture of ocean"></a>
<a href="imgorion.jpg" class="newWin"><img src="thimgorion.jpg" alt="picture of orion"></a>
<a href="imgtree.jpg" class="newWin"><img src="thimgtree.jpg" alt="picture of tree"></a>

RE: javascript photo gallery script

The link would need to be to a page containing the image, rather then the image itself.


RE: javascript photo gallery script

Audiopro is correct. You are linking directly to the image file so no way to add anything to it like a link.
If you need to show extra html elements like a link to a pdf, then you would need to make the url an actual html page that displays the image along with any other html you need.

As it stands all you are doing is opening the image file in a new Window.

Phil AKA Vacunita
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech

RE: javascript photo gallery script

Thank you for letting me know.

I got to thinking about it and wondered why I didn't think of that; an html file instead of just an image.
Makes sense.

Again thanks for taking the time to remind me.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close