PDA

View Full Version : Problem Quoting



evilacme
01-09-2007, 08:49 PM
I'm having a little trouble with my script and I've narrowed it down, hopefully, to this line of code. I believe it is because the quoting is wrong. I'm having a little bit of trouble getting it right, can someone give me a hand?



var tempcontainer=galleryarray[i][3]!=""? '<a href="javascript:popImage('+galleryarray[i][3]+','+galleryarray[i][1]+')">' : ""


The end result should look like this as the link:
javascript:popImage('photo_album/1.jpg','optional title')

The array is setup as follows:


var galleryarray=new Array()
galleryarray[0]=["photo_album/1.jpg", "optional title", "optional description", "photo_album/1.jpg"]

codeexploiter
01-10-2007, 09:06 AM
var tempcontainer=galleryarray[i][3]!=""? "<a href=\"javascript:popImage('"+galleryarray[i][3]+"','"+galleryarray[i][1]+"');\">" : ""

The above mentioned item will give you


<a href="javascript:popImage('photo_album/1.jpg','optional title');">

evilacme
01-10-2007, 02:24 PM
Thanks! Works perfectly.