PDA

View Full Version : Conveyor Belt Slideshow - Error "Expected';'"



tmorgan
01-20-2006, 04:33 PM
I realize that this may be a bit out of the scope of the forums but I'm giving this a shot since I'm at wits end with this.I am 98% complete in creating a "billboard" site using the (modified) Conveyor Belt Slideshow (http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm)

The test page (http://www.gregbeeche.com/index1.html) w/ modified slideshow script.

Supporting JS (http://www.gregbeeche.com/js/gbl.js) and
CSS (http://www.gregbeeche.com/style/gbl.css) files.

The entire site (http://www.gregbeeche.com/ConveyorSite.zip) (1.5Mb ZIP)

The affected sections:
- An iFrame (center right) for previewing slideshow photos
- A layer (lower right) for info text

The functionality is this:
- Slideshow starts static
- Clicking Play button starts slide show
- Mouseover slows slideshow
- Clicking picture should do three things (similar to what the links at the bottom of the page do);
stop slideshow (works)
display larger photo in iFrame id=preview (works)
display info text in frame using "swaplayers()" in JS file (broke)

The problem line (#90) is this:
leftrightslide[0]='<a href="film01.html" target="preview" onClick="stopslide();swapLayers(lyr5);return true"><img src="Film/01.jpg" border=0>'
(Only this line has the layer swapping function for now)

The fault occurs when I write - swapLayers('lyr5') - I get these errors:
1)Line:90
Char:92
Code:0
Error:Expected ';'
2)Line:24
Char:1
Code:0
Error:Object expected
3)The slideshow photos do not load

I suspect the fault is in the body onload events but can't seem to to track it although I continue to try. Any hints would be great! I'd really hate to have to overhaul this to make it work, but if I must.... Thanks in advance folks.

Twey
01-20-2006, 05:18 PM
No, this isn't out of our scope at all.
a.featureLinks:visited:hover {
font-size: 12px;
color: ##005500;
text-decoration: none;
}First of all, watch where you're putting those hashes. You could have someone's eye out. :)
Secondly, see:
function stopslide(){
copyspeed=0
clearInterval(lefttime)
}This obviously causes an error if the slideshow hasn't started yet, as lefttime doesn't exist. Add simple error checking:
function stopslide(){
if(!lefttime) return;
copyspeed=0
clearInterval(lefttime)
}
Thirdly, one problem in your first example is that you're passing it a non-existent variable where it expects a string. If that actually is a valid object, it shouldn't be. Pass it the ID of the element, as a string, surrounded in quotes. Could you do this on your demo page?

tmorgan
01-20-2006, 05:42 PM
Thirdly, one problem in your first example is that you're passing it a non-existent variable where it expects a string. If that actually is a valid object, it shouldn't be. Pass it the ID of the element, as a string, surrounded in quotes.

Thanks Twey, are you referring to the "swapLayers(lyr5)" argument? "lyr5" is the id of the layer. But when I wrap it with "" or '' I get the errors previously stated. The site is now posted with the ' ' quotes. Perhaps I'm not understanding your request... other changes made & posted.

Twey
01-20-2006, 05:50 PM
You need to escape those single quotes, as the whole tag is already wrapped in single quotes.

tmorgan
01-20-2006, 06:14 PM
I've tried several ways to escape the quotes previously:
\'lyr5\'

Then by inserting a string delimiter in the string literal:
'\'lyr5\''
'"lyr5"'
"\"lyr5\""

and on and on... nothing seems to work, still get the errors. That's why I think there's an onload conflict.

Twey
01-20-2006, 06:21 PM
No, an onload conflict would result in a very different set of symptoms.
leftrightslide[0]='<a href="film01.html" target="preview" onClick="stopslide();swapLayers(\'lyr5\');return false;"><img src="Film/01.jpg" border=0></a>';That should work nicely.

tmorgan
01-20-2006, 06:21 PM
OK, I just tried this...
/'/lyr5/'/
"/'/lyr5/'/"

And now get... getting closer
Line:90
Char:1
Code:0
Error:'lyr5' is undefined

tmorgan
01-20-2006, 06:24 PM
I've tried (\'lyr5\') previously ... the errors go away, but the layer does not display.

Twey
01-20-2006, 06:27 PM
OK, I just tried this...
/'/lyr5/'/
"/'/lyr5/'/"
The last one won't work because no such element exists :) You can't escape with forward slashes.
Apply my code on your demo page and let me see.

tmorgan
01-20-2006, 06:31 PM
Code applied & posted. I had tried the the one semi-colon but not at the end of the line. No errors but also no layer.

Twey
01-20-2006, 07:00 PM
Aha.
Replace:
if(!lefttime) return;in that code I gave you with
if(typeof lefttime === "undefined") return;That ought to work.

tmorgan
01-20-2006, 07:18 PM
Brilliant! but it lost the picture preview in the iFrame. This is just the madness I've gotten with this for a while. Fix one thing, break the other.

tmorgan
01-20-2006, 09:54 PM
Thanks much for your time Twey, you've gotten me farther than I've been for a couple of days. I'll have to tweak more.