Jump to content

how do i get a link to change dynamically with images from a thumbnail gallery?


ana1020

Recommended Posts

hi,

 

i programmed this website http://www.liveatsummitsprings.com/homes.html using a javascript image gallery (http://devkick.com/lab/galleria/). it's pretty fancy and i don't pretend to understand it fully. i want a 'Download this PDF' link for every picture that is currently enlarged, but the link has to change dynamically, the same way each picture changes on click, since each picture has a specific pdf.

 

i think i have to use the 'onclick' function, but i don't know javascript enough to be sure. i don't know if i need to have an array which stores each file path (i.e. pdf1 = "<a href= "pdf/MountainLaurelSheets.pdf"></a>"; pdf2 = "<a href= "pdf/HickorySheets.pdf"></a>"; ... etc.).

 

does anyone know how to get a link to change dynamically with its corresponding image?

 

- ana

Hi ya,

 

You can try something along the lines of this;

 

<html>

<a href="pdf1" id="pdf_link">blah</a>

 

<code>

document.getElementById('pdf_link').href = pdf2;

 

You have the ability to alter pretty much any attribute of pretty much any element (a little overstated but yer) at runtime so during some event such as the onclick event of another link you can then add the above code to alter the href attribute of the link.

 

Hope it helps,

 

Mike

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.