![]() |
Adding hyperlinks to a slideshow
2 Attachment(s)
I have been trying to develop a script that creates a slideshow that adds hyperlinks to the images.
I'm a beginner at Javascript, so I've made a bastardisation of 3 different scripts I've found that, by my reckoning, should work. This is the slideshow code: Code:
window.onload = initAll;<div id="view_portfolio"> </div>Does anyone know why the javascript doesn't work? I have a feeling it's because I haven't applied the id tag in the HTML properly, but I don't know what exactly is wrong about it. I am hoping someone here can shed some light on the situation! The gallery I have made so far is at http://www.clarebyrnedesign.com.au/portfolio.html, except that at the moment, the images don't show. I've attached the javascript & html code. Thanks! |
This
document.getElementById("view_portfolio").src = gallery_url[thisUrl]+'<img src="'+thisImage+'"></a>'; Should be this: document.getElementById("view_portfolio").innerHTML = gallery_url[thisUrl]+'<img src="'+thisImage+'"></a>'; <div> tags to not have an src attribute |
I changed src to innerHTML & it didn't make any difference ... I'm pretty sure I tried that when I was first trying to make it work. I tried using a span instead of a div as well, but that didn't work either ...
|
Ok, I did just discover that I didn't close the image tag in the javascript file properly *facepalm*
This is what both those lines now reads: document.getElementById("view_portfolio").innerHTML = gallery_url[thisUrl]+'<img src="'+thisImage+'" alt="" width="450" height="317" border="0" /></a>'However ... It still doesn't work. Which is frustrating. Is the problem possibly rooted in my html coding? |
| All times are GMT +1. The time now is 01:25 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.