Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple javascript link question

Status
Not open for further replies.

jpmad4it

Programmer
Sep 2, 2003
5
0
0
GB
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>';


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="" />'

If anyone can help then you'll be a legend to me!

Kind regards
Jonathan
 
fixed:

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>";
 
It's always fun trying to figure out the mixed quotes and which ones to escape. :)#

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top