PDA

View Full Version : Slideshow Script Troubles



Dredzs
11-13-2005, 06:40 AM
I can't figure out what is going wrong with this script. The error on the Explorer page says it's an unterminated string constant. I've gone throught the code several times and tried recopying. Here's the code as it stands now:

<script language="JavaScript1.2">

/***********************************************
* Flexi Slideshow- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var variableslide=new Array()

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

variableslide[0]=['http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=584', '', '<a href="http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=545">Interview with Dr. Stephen Meyer - leader in the I.D. movement (Long clip - 42.5 mb)</a>
<br><a href="http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=499">Same as above but just in Audio (3.29 mb)</a>']

variableslide[1]=['http://www.reviewevolution.net/graphics/openFlagellum.jpg', '', '<i><small>A prime example of Michael Behe's "irreducible complexity" is the bacteria flagellum. With over 40 essential parts, the flagellum is a rotary motor used to propel a bacteria in liquid. Spinning at 17,000 rpms, the motor is acid driven, liquid cooled, self-replicating, and self-repairing. If one part is removed, it can not function</small></i>
<br>
If it could be demonstrated that any complex organ existed which could not possibly have been formed by numerous, successive, slight modifications, my theory would absolutely break down.<br>
~ Charles Darwin, Origin of Species

<br><a href="http://www.sedin.org/mol_museum.html">Click Here for a theistic blog</a>
<br><a href="http://www.evolutionnews.org/2005/09/title_43.html">Click Here for a atheistic blog</a>
<br><a href="http://www.talkdesign.org/faqs/flagellum.html">Or here</a>']

variableslide[2]=['http://www.getreligion.org/archives/DNA.jpg', '', '<i>DNA is a more advanced code than what we have for computer programming. In order to have a computer program, you must have a Programmer. Does this mean that it in order to have DNA Code, there must be a Code Writer?</i><br>
<a href="http://www.allaboutscience.org/dna-double-helix.htm">DNA Info Site</a><br>
<a href="http://www.eweek.com/article2/0,1759,1645675,00.asp">People are even using DNA code to replace computer coding. See this article.</a>']

variableslide[3]=['http://www.pinkdome.com/archives/ethics.gif', '', '<center><i>Good or Bad Explanation for Morals? Where do all 3 come from?</i><br></center>']

//configure the below 3 variables to set the dimension/background color of the slideshow

var slidewidth='325px' //set to width of LARGEST image in your slideshow
var slideheight='500px' //set to height of LARGEST image in your slideshow, plus any text description
var slidebgcolor='#0E0E0E'

//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=4000

////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>

jscheuer1
11-13-2005, 07:39 AM
It is impossible for me to tell what errors may be in that code. After you paste in your code you need to highlight it all and then hit the # symbol in the editor to enclose it in code tags. That way the normal line wrap of the editor will be suspended and a textarea created to contain your code. Better still is to:

whatever
.

Dredzs
11-13-2005, 04:07 PM
Sorry, here's the links:
http://www.dynamicdrive.com/dynamicindex14/flexislide.htm
http://moriasophy.blogspot.com

And here's the script again:
-----------------------------------------------------------------------



<script language="JavaScript1.2">

/***********************************************
* Flexi Slideshow- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var variableslide=new Array()

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

variableslide[0]=['http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=584', '', '<a href="http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=545">Interview with Dr. Stephen Meyer - leader in the I.D. movement (Long clip - 42.5 mb)</a>
<br><a href="http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=499">Same as above but just in Audio (3.29 mb)</a>']

variableslide[1]=['http://www.reviewevolution.net/graphics/openFlagellum.jpg', '', '<i><small>A prime example of Michael Behe's "irreducible complexity" is the bacteria flagellum. With over 40 essential parts, the flagellum is a rotary motor used to propel a bacteria in liquid. Spinning at 17,000 rpms, the motor is acid driven, liquid cooled, self-replicating, and self-repairing. If one part is removed, it can not function</small></i>
<br>
If it could be demonstrated that any complex organ existed which could not possibly have been formed by numerous, successive, slight modifications, my theory would absolutely break down.<br>
~ Charles Darwin, Origin of Species

<br><a href="http://www.sedin.org/mol_museum.html">Click Here for a theistic blog</a>
<br><a href="http://www.evolutionnews.org/2005/09/title_43.html">Click Here for a atheistic blog</a>
<br><a href="http://www.talkdesign.org/faqs/flagellum.html">Or here</a>']

variableslide[2]=['http://www.getreligion.org/archives/DNA.jpg', '', '<i>DNA is a more advanced code than what we have for computer programming. In order to have a computer program, you must have a Programmer. Does this mean that it in order to have DNA Code, there must be a Code Writer?</i><br>
<a href="http://www.allaboutscience.org/dna-double-helix.htm">DNA Info Site</a><br>
<a href="http://www.eweek.com/article2/0,1759,1645675,00.asp">People are even using DNA code to replace computer coding. See this article.</a>']

variableslide[3]=['http://www.pinkdome.com/archives/ethics.gif', '', '<center><i>Good or Bad Explanation for Morals? Where do all 3 come from?</i><br></center>']

//configure the below 3 variables to set the dimension/background color of the slideshow

var slidewidth='325px' //set to width of LARGEST image in your slideshow
var slideheight='500px' //set to height of LARGEST image in your slideshow, plus any text description
var slidebgcolor='#0E0E0E'

//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=4000

////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>


I know I'm missing something and that it's just right under my nose but I can't find it! I'm going to feel stupid once this is over.

Please help,
Dredzs

jscheuer1
11-13-2005, 05:07 PM
Ah, that's much better, thanks. The various entries characterized as:


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

Must be all on one line or use conventions that make them appear that way to the script parser. Since the easiest way is simply to use 'all on one line', just replace:


variableslide[0]=['http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=584', '', '<a href="http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=545">Interview with Dr. Stephen Meyer - leader in the I.D. movement (Long clip - 42.5 mb)</a>
<br><a href="http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=499">Same as above but just in Audio (3.29 mb)</a>']

variableslide[1]=['http://www.reviewevolution.net/graphics/openFlagellum.jpg', '', '<i><small>A prime example of "irreducible complexity" is the bacteria flagellum. With over 40 essential parts, the flagellum is a rotary motor used to propel a bacteria in liquid. Spinning at 17,000 rpms, the motor is acid driven, liquid cooled, self-replicating, and self-repairing. If one part is removed, it can not function</small></i>
<br>
If it could be demonstrated that any complex organ existed which could not possibly have been formed by numerous, successive, slight modifications, my theory would absolutely break down.<br>
- Charles Darwin, Origin of Species

<br><a href="http://www.sedin.org/mol_museum.html">Click Here for a theistic blog</a>
<br><a href="http://www.evolutionnews.org/2005/09/title_43.html">Click Here for an atheistic blog</a>
<br><a href="http://www.talkdesign.org/faqs/flagellum.html">Or here</a>']

variableslide[2]=['http://www.getreligion.org/archives/DNA.jpg', '', '<i>DNA is a more advanced code than what we have for computer programming. In order to have a computer program, you must have a Programmer. Does this mean that it in order to have DNA Code, there must be a Code Writer?</i><br>
<a href="http://www.allaboutscience.org/dna-double-helix.htm">DNA Info Site</a><br>
<a href="http://www.eweek.com/article2/0,1759,1645675,00.asp">Scientists are even using DNA code to replace computer coding. See this article.</a>']

variableslide[3]=['http://www.pinkdome.com/archives/ethics.gif', '', '<center><i>Good or Bad Explanation for Morals? Where do all 3 come from?</i><br></center>']

with:


variableslide[0]=['http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=584', '', '<a href="http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=545">Interview with Dr. Stephen Meyer - leader in the I.D. movement (Long clip - 42.5 mb)</a> <br><a href="http://www.discovery.org/scripts/viewDB/filesDB-download.php?command=download&id=499">Same as above but just in Audio (3.29 mb)</a>']

variableslide[1]=['http://www.reviewevolution.net/graphics/openFlagellum.jpg', '', '<i><small>A prime example of "irreducible complexity" is the bacteria flagellum. With over 40 essential parts, the flagellum is a rotary motor used to propel a bacteria in liquid. Spinning at 17,000 rpms, the motor is acid driven, liquid cooled, self-replicating, and self-repairing. If one part is removed, it can not function</small></i><br>If it could be demonstrated that any complex organ existed which could not possibly have been formed by numerous, successive, slight modifications, my theory would absolutely break down.<br>- Charles Darwin, Origin of Species<br><a href="http://www.sedin.org/mol_museum.html">Click Here for a theistic blog</a><br><a href="http://www.evolutionnews.org/2005/09/title_43.html">Click Here for an atheistic blog</a><br><a href="http://www.talkdesign.org/faqs/flagellum.html">Or here</a>']

variableslide[2]=['http://www.getreligion.org/archives/DNA.jpg', '', '<i>DNA is a more advanced code than what we have for computer programming. In order to have a computer program, you must have a Programmer. Does this mean that it in order to have DNA Code, there must be a Code Writer?</i><br><a href="http://www.allaboutscience.org/dna-double-helix.htm">DNA Info Site</a><br><a href="http://www.eweek.com/article2/0,1759,1645675,00.asp">Scientists are even using DNA code to replace computer coding. See this article.</a>']

variableslide[3]=['http://www.pinkdome.com/archives/ethics.gif', '', '<center><i>Good or Bad Explanation for Morals? Where do all 3 come from?</i><br></center>']

Works here in a local demo.

Dredzs
11-14-2005, 04:20 AM
Thanks! I really appreciate it. :) :D