View Full Version : Need help to understand this javascript code

02-23-2011, 07:20 PM
Hi, I'm trying to alter this piece of code but first need to understand HOW it works.


var layerHTML=(imgelement[1])? '<a href="'+imgelement[1]+'" target="'+imgelement[2]+'">\n' : '' //hyperlink slide?
layerHTML+='<img src="'+imgelement[0]+'" style="border-width:0" />'
layerHTML+=(imgelement[1])? '</a>' : ''
return layerHTML //return HTML for this layer
It's for the simplegallery image viewer and I would like to change the "hyperlink slide" in order for it to open a specified page with a specified imgsrc rather than just a specified page. I have tried some html but got nowhere and this is probably due to my not understanding this piece of code!

["Samurai/001.jpg", "LargeImage.htm", "", ""],

"Samurai/001.jpg" - element[0] is the image displayed in the gallery
"LargeImage.htm" - element[1] is the page I would like to hyperlink to and specify its imgsrc from element[2]

Thanks, Lol