PDA

View Full Version : Blending image slideshow question



rufman
11-25-2008, 02:59 AM
1) Script Title:
Blending Image Slideshow Script (Best seen with IE 4+)

2) Script URL (on DD)
http://www.dynamicdrive.com/dynamicindex14/image4.htm

3) Describe problem:
Is it possible to use the same script for mulitple images? I have different parts of my home page that I want to use this on, do I need to enter all scripting info both in the header and the body each time or is there a way to tweak the first one to work with muliple locations on my page?

Snookerman
11-25-2008, 07:28 AM
You do have to put it on each page where you want this to work, however, instead of having all the code (i.e. the part inside the <script></script> tags) you can put that code into one javascript file (ends with .js) and then link to it. You still have to do it on each page but there is less work and less code to process. Make sure you put the link in the same place the script code should be. Here's an example:

This part:

<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("image1.gif","image2.gif","image3.gif")

//specify corresponding links
var slidelinks=new Array("http://www.dynamicdrive.com","http://javascriptkit.com","http://www.geocities.com")

var newwindow=1 //open links in new window? 1=yes, 0=no

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 (newwindow)
window.open(slidelinks[whichlink])
else
window.location=slidelinks[whichlink]
}

//-->
</script>
could look like this:

<script type="text/javascript" language="javascript1.1" src="myscripts/slideshowscript.js">
Then put all the code between the scrip tags (do not include the actual tags) into the file slideshowscript.js in your myscripts folder. The file should just be an empty page, no html code.