Hi there, I am trying to edit the following JS below. This is a javascript file itself and not an HTML file, so the syntax is confusing me. I am struggling to get the correct syntax for adding the link on the image in the array. All its meant to do is simply pop-up a window using a link on an image in the array. The problem line out of the whole code is this one: leftrightslide[0]='<a href="javascript:PHOTO_WINDOW('Flash/scroll_images/orig/image0.jpg','1000','1000');"><img src="Flash/scroll_images/image0.jpg" alt="" /></a>'; Code (markup): Here is the full part of this code: function PHOTO_WINDOW(link, width, height) //URL, height and width of image passed to function { var photoWindow = window.open(link,"photo",'toolbar=0, title=0, location=0, status=0, directories=0,status_bar=0,menubar=0,scrollbars=1,resizable=1'); } //Specify the slider's images var leftrightslide=new Array(); var finalslide='' leftrightslide[0]='<a href="javascript:PHOTO_WINDOW('Flash/scroll_images/orig/image0.jpg','1000','1000');"><img src="Flash/scroll_images/image0.jpg" alt="" /></a>'; leftrightslide[1]='<img src="Flash/scroll_images/image1.jpg" alt="" />' leftrightslide[2]='<img src="Flash/scroll_images/image2.jpg" alt="" />' leftrightslide[3]='<img src="Flash/scroll_images/image3.jpg" alt="" />' leftrightslide[4]='<img src="Flash/scroll_images/image4.jpg" alt="" />' leftrightslide[5]='<img src="Flash/scroll_images/image5.jpg" alt="" />' leftrightslide[6]='<img src="Flash/scroll_images/image6.jpg" alt="" />' leftrightslide[7]='<img src="Flash/scroll_images/image7.jpg" alt="" />' leftrightslide[8]='<img src="Flash/scroll_images/image8.jpg" alt="" />' leftrightslide[9]='<img src="Flash/scroll_images/image10.jpg" alt="" />' leftrightslide[10]='<img src="Flash/scroll_images/image11.jpg" alt="" />' leftrightslide[11]='<img src="Flash/scroll_images/image12.jpg" alt="" />' leftrightslide[12]='<img src="Flash/scroll_images/image13.jpg" alt="" />' leftrightslide[13]='<img src="Flash/scroll_images/image14.jpg" alt="" />' leftrightslide[14]='<img src="Flash/scroll_images/image15.jpg" alt="" />' leftrightslide[15]='<img src="Flash/scroll_images/image16.jpg" alt="" />' leftrightslide[16]='<img src="Flash/scroll_images/image17.jpg" alt="" />' leftrightslide[17]='<img src="Flash/scroll_images/image18.jpg" alt="" />' Code (markup): If anyone can help then you'll be a legend to me! Kind regards Jonathan
Try it this way: leftrightslide[0]="<a href='#' onclick=\"PHOTO_WINDOW('Flash/scroll_images/orig/image0.jpg','1000','1000');return false;\"><img src='Flash/scroll_images/image0.jpg' alt='' /></a>"; Code (markup):
You're welcome. The general rule is to use single quotes inside double quotes, when double quotes are required, when calling a function that passes arguments within single quotes, then "escape" the double quotes, with a leading backslash: onclick=\"PHOTO_WINDOW('Flash/scroll_images/orig/image0.jpg','1000','1000');return false;\">