nfinity
04-16-2008, 03:51 PM
When I hard code a link, the lightbox works just fine:
<a href="http://www.harpandharptrading.com/images/tractors/6640ford.jpg" rel="lightbox[trac1]" title="my caption">image #1</a>
But, I need to create the links dynamically using javascript which I did with the following code:
var link = document.createElement("a");
link.href = "images/tractors/6640ford.jpg";
link.rel = "lightbox[trac1]";
link.title = "my caption";
link.innerHTML = "image1";
The link appears and when I look at it with firebug, it looks the same as the one I hard coded. But, when i click the link it takes me to a new page with just the image on it like it would if I typed in the url to the image.
Can someone help please?
http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm
<a href="http://www.harpandharptrading.com/images/tractors/6640ford.jpg" rel="lightbox[trac1]" title="my caption">image #1</a>
But, I need to create the links dynamically using javascript which I did with the following code:
var link = document.createElement("a");
link.href = "images/tractors/6640ford.jpg";
link.rel = "lightbox[trac1]";
link.title = "my caption";
link.innerHTML = "image1";
The link appears and when I look at it with firebug, it looks the same as the one I hard coded. But, when i click the link it takes me to a new page with just the image on it like it would if I typed in the url to the image.
Can someone help please?
http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm