Click to See Complete Forum and Search --> : javascript 2nd line in variable?
Danielmcn
11-10-2003, 05:46 PM
I am trying use a JavaScript vertical scrolling text script and have to much content to put on one line. The script doesn't work when I add lines to the variable that contains the content to be scrolled. What do I have to do to add lines?
Thanks,
Dan McNellis
danielmcn@aol.com
KeithMcL
11-10-2003, 06:36 PM
Can you post the code you have?
Danielmcn
11-10-2003, 10:12 PM
here is the code, My question pertains to the "marqueecontents" variable: How can I add new lines to this variable? The script works only if the content of that variable is confined to one line. I have to much content for that.
<script language="JavaScript1.2">
/*
Cross browser marquee script II-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
//Specify the marquee's width (in pixels)
var marqueewidth=175
//Specify the marquee's height
var marqueeheight=70
//Specify the marquee's scroll speed (larger is faster)
var speed=2
//Specify the marquee contents
var marqueecontents='Message that you want to be scrolled, goes here'
if (document.all)
document.write('<marquee direction="up" scrollAmount='+speed+' style="width:'+marqueewidth+';height:'+marqueeheight+'">'+marqueecontents+'</marquee>')
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializemarquee()
}
}
function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write(marqueecontents)
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.height
scrollit()
}
function scrollit(){
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.top-=speed
setTimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.top=marqueeheight
scrollit()
}
}
window.onload=regenerate2
</script>