Results 1 to 2 of 2

Thread: Slideshow shows 'Undefined' text

  1. #1
    Join Date
    Mar 2016
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Slideshow shows 'Undefined' text

    Hi Guys,

    I was wondering if you could help. I've been playing with slideshows today and found great one at Dynamic Drive. Yet after integrating the code, the text underneath shows: 'Undefined' and I have no idea where to change it / remove it. Please help? Below is the code and screen shot:

    Click image for larger version. 

Name:	slideshow screen shot.jpg 
Views:	164 
Size:	45.2 KB 
ID:	5841


    Code:
    <script language="JavaScript1.2">
    
    var variableslide=new Array()
    
    //variableslide[x]=["path to image", "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)"]
    
    variableslide[0]=["https://farm2.staticflickr.com/1497/25124601229_90604fb064_b.jpg"]
    variableslide[1]=["https://farm2.staticflickr.com/1544/25196538220_755bfa57b8_b.jpg"]
    variableslide[2]=["https://farm2.staticflickr.com/1711/24865434833_8759084fed_k.jpg"]
    variableslide[3]=["https://farm2.staticflickr.com/1709/25373709692_bbbd7d1da8_k.jpg"]
    variableslide[4]=["https://farm2.staticflickr.com/1603/25466014396_475df73d82_b.jpg"]
    variableslide[5]=["https://farm2.staticflickr.com/1556/25373732262_7ce94cecb5_b.jpg"]
    variableslide[6]=["https://farm2.staticflickr.com/1537/25492103585_d2339eee89_b.jpg"]
    variableslide[7]=["https://farm2.staticflickr.com/1529/24861576224_d10ddae157_b.jpg"]
    variableslide[8]=["https://farm2.staticflickr.com/1466/25124597469_d8dec7aeac_b.jpg"]
    
    //configure the below 3 variables to set the dimension/background color of the slideshow
    
    var slidewidth='1024px' //set to width of LARGEST image in your slideshow
    var slideheight='683px' //set to height of LARGEST iamge in your slideshow, plus any text description
    var slidebgcolor='#ffffff'
    
    //configure the below variable to determine the delay between image rotations (in miliseconds)
    var slidedelay=3000
    
    ////Do not edit pass this line////////////////
    
    var ie=document.all
    var dom=document.getElementById
    
    for (i=0;i<variableslide.length;i++){
    var cacheimage=new Image()
    cacheimage.src=variableslide[i][0]
    }
    
    var currentslide=0
    
    function rotateimages(){
    contentcontainer='<center>'
    if (variableslide[currentslide][1]!="")
    contentcontainer+='<a href="'+variableslide[currentslide][1]+'">'
    contentcontainer+='<img src="'+variableslide[currentslide][0]+'" border="0" vspace="3">'
    if (variableslide[currentslide][1]!="")
    contentcontainer+='</a>'
    contentcontainer+='</center>'
    if (variableslide[currentslide][2]!="")
    contentcontainer+=variableslide[currentslide][2]
    
    if (document.layers){
    crossrotateobj.document.write(contentcontainer)
    crossrotateobj.document.close()
    }
    else if (ie||dom)
    crossrotateobj.innerHTML=contentcontainer
    if (currentslide==variableslide.length-1) currentslide=0
    else currentslide++
    setTimeout("rotateimages()",slidedelay)
    }
    
    if (ie||dom)
    document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')
    
    function start_slider(){
    crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
    if (document.layers)
    document.slidensmain.visibility="show"
    rotateimages()
    }
    
    if (ie||dom)
    start_slider()
    else if (document.layers)
    window.onload=start_slider
    
    </script>
    
    <ilayer id="slidensmain" width=&{slidewidth}; height=&{slideheight}; bgColor=&{slidebgcolor}; visibility=hide><layer id="slidenssub" width=&{slidewidth}; left=0 top=0></layer></ilayer>
    
    <p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
    <a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>
    Last edited by jscheuer1; 03-04-2016 at 06:19 PM. Reason: format code

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    This little part here is an instruction/template:

    Code:
    //variableslide[x]=["path to image", "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)"]
    However, here:

    Code:
    variableslide[0]=["https://farm2.staticflickr.com/1497/25124601229_90604fb064_b.jpg"]
    variableslide[1]=["https://farm2.staticflickr.com/1544/25196538220_755bfa57b8_b.jpg"]
    variableslide[2]=["https://farm2.staticflickr.com/1711/24865434833_8759084fed_k.jpg"]
    variableslide[3]=["https://farm2.staticflickr.com/1709/25373709692_bbbd7d1da8_k.jpg"]
    variableslide[4]=["https://farm2.staticflickr.com/1603/25466014396_475df73d82_b.jpg"]
    variableslide[5]=["https://farm2.staticflickr.com/1556/25373732262_7ce94cecb5_b.jpg"]
    variableslide[6]=["https://farm2.staticflickr.com/1537/25492103585_d2339eee89_b.jpg"]
    variableslide[7]=["https://farm2.staticflickr.com/1529/24861576224_d10ddae157_b.jpg"]
    variableslide[8]=["https://farm2.staticflickr.com/1466/25124597469_d8dec7aeac_b.jpg"]
    For each on you have left , "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)" both "undefined" only the description is shown though, so that's what you see. Now, while coding this script that could have been dealt with. But it wasn't. So you have to by supplying empty fields for any of the options you don't want to use, like so:

    Code:
    variableslide[0]=["https://farm2.staticflickr.com/1497/25124601229_90604fb064_b.jpg", "", ""]
    variableslide[1]=["https://farm2.staticflickr.com/1544/25196538220_755bfa57b8_b.jpg", "", ""]
    variableslide[2]=["https://farm2.staticflickr.com/1711/24865434833_8759084fed_k.jpg", "", ""]
    variableslide[3]=["https://farm2.staticflickr.com/1709/25373709692_bbbd7d1da8_k.jpg", "", ""]
    variableslide[4]=["https://farm2.staticflickr.com/1603/25466014396_475df73d82_b.jpg", "", ""]
    variableslide[5]=["https://farm2.staticflickr.com/1556/25373732262_7ce94cecb5_b.jpg", "", ""]
    variableslide[6]=["https://farm2.staticflickr.com/1537/25492103585_d2339eee89_b.jpg", "", ""]
    variableslide[7]=["https://farm2.staticflickr.com/1529/24861576224_d10ddae157_b.jpg", "", ""]
    variableslide[8]=["https://farm2.staticflickr.com/1466/25124597469_d8dec7aeac_b.jpg", "", ""]
    That will take care of it!
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. GoldenGlobe template shows text over-printing
    By Sparkplug21 in forum HTML
    Replies: 0
    Last Post: 02-26-2012, 04:07 AM
  2. undefined error in up down image slideshow script
    By kad in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 08-13-2009, 03:52 PM
  3. Ultimate Fade-in slideshow (v1.51) - Error 'Fadeshow is undefined'
    By huron in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 07-08-2009, 10:19 AM
  4. Flexi Slideshow shows white space to new visitor before page is cached
    By BizProf in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 08-29-2008, 02:06 AM
  5. add text between slide shows
    By jcallen04 in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 02-12-2008, 02:06 AM

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
  •