ana1020 Posted August 20, 2008 Share Posted August 20, 2008 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 Link to comment https://forums.phpfreaks.com/topic/120611-how-do-i-get-a-link-to-change-dynamically-with-images-from-a-thumbnail-gallery/ Share on other sites More sharing options...
Mijii Posted August 21, 2008 Share Posted August 21, 2008 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 Link to comment https://forums.phpfreaks.com/topic/120611-how-do-i-get-a-link-to-change-dynamically-with-images-from-a-thumbnail-gallery/#findComment-621565 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.