PDA

View Full Version : Conveyor Belt slideshow Does Not Work



NightZEN
11-04-2007, 07:08 PM
Script name: Conveyor Belt slideshow
url: http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm

Problem:
I have inserted this script into my webpage, and it does not work. Do I have to change something in the header to allow for dhtml to work correctly? Any help you can give me would be great!

Header:


<html><head>
<title> Purr Toys
</title>
<link href="/images/favicon.ico" type="image/x-icon" rel="icon"/><link href="/images/favicon.ico" type="image/x-icon" rel="shortcut icon"/>

<link rel="stylesheet" href="/colbox6.css" type="text/css">

<meta content="MSHTML 6.00.5730.11" name=GENERATOR>

</head>



Code in question, as it renders on my site:


<script type="text/javascript">

//Specify the slider's width (in pixels)
var sliderwidth="500px"
//Specify the slider's height
var sliderheight="150px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=3
//configure background color:
slidebgcolor="#000000"

//Specify the slider's images
var leftrightslide=new Array()
var finalslide='<a href='/servlet/Detail?no=65&sfs=7f102b9f'><img src="/catalog/erosBodyGlide_100.jpg" width="100" border="0"></a>'





leftrightslide[0]='<a href='/servlet/Detail?no=65&sfs=9573f9ff'><img src="/catalog/erosBodyGlide_100.jpg" width="100" border="0"></a>'




leftrightslide[1]='<a href='/servlet/Detail?no=109&sfs=9573f9ff'><img src="/catalog/maximus_100.jpg" width="100" border="0"></a>'




leftrightslide[2]='<a href='/servlet/Detail?no=203&sfs=9573f9ff'><img src="/catalog/beautybeads_100jpg.jpg" width="100" border="0"></a>'




leftrightslide[3]='<a href='/servlet/Detail?no=205&sfs=9573f9ff'><img src="/catalog/bendoverbeginer_100.jpg" width="100" border="0"></a>'



//Specify gap between each image (use HTML):
var imagegap=" "

//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=5

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide

function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup

function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"

if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"

}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap

if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}


if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>

jscheuer1
11-04-2007, 08:50 PM
Two things jump out:

var finalslide=''

shouldn't be defined (maybe not even declared), I have no idea why it was ever included in the release version of the code (I didn't write it). Just leave it as it is on the demo page (declared but with no value), just to be on the safe side.

Next, and more important, you cannot do this (red):


leftrightslide[0]='<a href='/ser

because the moment you do, it closes the array entry that was opened with leftrightslide[0]=' prematurely.

So instead of:


leftrightslide[0]='<a href='/servlet/Detail?no=65&sfs=9573f9ff'><img src="/catalog/erosBodyGlide_100.jpg" width="100" border="0"></a>'

and all similar, use:


leftrightslide[0]='<a href="/servlet/Detail?no=65&sfs=9573f9ff"><img src="/catalog/erosBodyGlide_100.jpg" width="100" border="0"></a>'

There could be other problems.

Also, that's a pretty old script, though that's probably not any part of the problem. Still, here is another version, also old, just not as old:

http://home.comcast.net/~jscheuer1/side/files/conveyor_oo.htm

If you still need help, to give us more of a fighting chance:

Please post a link to the page on your site that contains the problematic code so we can check it out.

It's so much easier to debug code that's live.

NightZEN
11-04-2007, 09:18 PM
Thanks John!

My site is (unfortunatly) hosted by ProStores (owned by ebay) and uses a custom markup language (SSML) to hit the database. It is with this SSML that I create the hyperlinks causing the single quote issue. In other words - I cannot change the links directly as I have it coded now.

Your info is valuable, however. Thanks for the insight! I will have to take a while to think my way around this and cod it a different way - SSML has some crappy limitations.

-nz

jscheuer1
11-04-2007, 09:32 PM
As long as there are no spaces in the href value, this would be acceptable (as far as the script is concerned):


leftrightslide[0]='<a href=/servlet/Detail?no=65&sfs=9573f9ff ><img src="/catalog/erosBodyGlide_100.jpg" width="100" border="0"></a>'

And, this will work, if allowed:


leftrightslide[0]='<a href=\'/servlet/Detail?no=65&sfs=9573f9ff\'><img src="/catalog/erosBodyGlide_100.jpg" width="100" border="0"></a>'

jscheuer1
11-04-2007, 09:36 PM
Oh, there's more, you could do this:


leftrightslide[0]="<a href='/servlet/Detail?no=65&sfs=9573f9ff'><img src='/catalog/erosBodyGlide_100.jpg' width='100' border='0'></a>"

NightZEN
11-11-2007, 05:09 PM
John,
Thanks for your help above - with it, I was able to get this code working. I'll give you the url, but it is not live yet. Check back in a few weeks on a product page to see it if you like:

www.mypurr.com

Thanks Again,
nz

NightPig
07-30-2008, 07:31 AM
NightZEN, can you make this conveyor belt slide show working in prostore?