PDA

View Full Version : Links in Blending Image Slideshow Script



mkobus
10-31-2005, 04:20 PM
Blending Image Slideshow Script
http://www.dynamicdrive.com/dynamicindex14/image4.htm

Greetings all. I am very much a js newbie, and have a problem that others may be able to solve with very little effort.

I am using the Blending image Slideshow Script on my site. I need to be able to change the
newwindow value according to the image being displayed. So in some cases I would like to open the link in a new window, in others i would like the link to open in the current window.

I thought that simply setting the
newwindow value as an array:

var newwindow=new Array("0", "1")

would work, but have found Im off base.

I did some forum searching and didnt see any similar threads...any help would be greatly appreicated.

ddadmin
10-31-2005, 08:03 PM
In other words, you're looking for selective link targeting for each image within the slideshow. Sure, simply replace the script of code 1 with the below instead:


<script language="JavaScript1.1">
<!--

//*****************************************
// Blending Image Slide Show Script-
// Dynamic Drive (www.dynamicdrive.com)
// For full source code, visit http://www.dynamicdrive.com/
//*****************************************

//specify interval between slide (in mili seconds)
var slidespeed=3000

//specify images
var slideimages=new Array("test.gif","image2.gif","image3.gif")

//specify link target for each image
var linktargets=new Array("", "_new", "_new")

//specify corresponding links
var slidelinks=new Array("http://www.google.com","http://yahoo.com","http://www.cnn.com")


var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[i]
}

function gotoshow(){
if (linktargets[whichlink]!="")
window.open(slidelinks[whichlink], linktargets[whichlink])
else
window.location=slidelinks[whichlink]
}

//-->
</script>

Customize "var linktargets".

mkobus
10-31-2005, 08:27 PM
Worked like a charm. Thanks so much for your help.