Results 1 to 2 of 2

Thread: Blending image slideshow question

  1. #1
    Join Date
    Nov 2008
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Lightbulb Blending image slideshow question

    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?

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    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:
    HTML Code:
    <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:
    HTML Code:
    <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.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •