Forum Moderators: open

Message Too Old, No Replies

Help with scrolling text

Breaks when I add a second line

         

mylittleopihi

10:48 pm on Aug 27, 2008 (gmt 0)

10+ Year Member



Hello Experts,
I'm new to Javascript, and I'm guessing there is a simple fix.

The script was created by someone who's no longer around.

It scrolls text vertically in a designated area on the page.

When I add a second line of scrolling text, the script fails to run. Nothing shows up.

Can anyone help?

Thank you!
Michelle

----------------------------------------------------

<script LANGUAGE="JavaScript">

<!-- Begin
//slider's width
var swidth=540

//slider's height
var sheight=120

//slider's speed
var sspeed=1

//messages: change to your own; use as many as you'd like; set up Hyperlinks to URLs as you normally do: <a target=... href="... URL ...">..message..</a>
var singletext=new Array()

singletext[0]='<div align="center"><font face=Arial size=2 color="black"><a href="news.html"><B> .......... CURRENT SCROLLING TEXT GOES HERE. NEED TO SKIP LINE AND ADD NEXT SECTION OF SCROLLING TEXT ..........</a></font></div>'
if (singletext.length>1)
i=1
else
i=0
function start(){
if (document.all){
ieslider1.style.top=sheight
iemarquee(ieslider1)
}
else if (document.layers){
document.ns4slider.document.ns4slider1.top=sheight
document.ns4slider.document.ns4slider1.visibility='show'
ns4marquee(document.ns4slider.document.ns4slider1)
}
else if (document.getElementById&&!document.all){
document.getElementById('ns6slider1').style.top=sheight
ns6marquee(document.getElementById('ns6slider1'))
}
}
function iemarquee(whichdiv){
iediv=eval(whichdiv)
if (iediv.style.pixelTop>0&&iediv.style.pixelTop<=sspeed){
iediv.style.pixelTop=0
setTimeout("iemarquee(iediv)",100)
}
if (iediv.style.pixelTop>=sheight*-1){
iediv.style.pixelTop-=sspeed
setTimeout("iemarquee(iediv)",100)
}
else{
iediv.style.pixelTop=sheight
iediv.innerHTML=singletext[i]
if (i==singletext.length-1)
i=0
else
i++
}
}
function ns4marquee(whichlayer){
ns4layer=eval(whichlayer)
if (ns4layer.top>0&&ns4layer.top<=sspeed){
ns4layer.top=0
setTimeout("ns4marquee(ns4layer)",100)
}
if (ns4layer.top>=sheight*-1){
ns4layer.top-=sspeed
setTimeout("ns4marquee(ns4layer)",100)
}
else{
ns4layer.top=sheight
ns4layer.document.write(singletext[i])
ns4layer.document.close()
if (i==singletext.length-1)
i=0
else
i++
}
}
function ns6marquee(whichdiv){
ns6div=eval(whichdiv)
if (parseInt(ns6div.style.top)>0&&parseInt(ns6div.style.top)<=sspeed){
ns6div.style.top=0
setTimeout("ns6marquee(ns6div)",100)
}
if (parseInt(ns6div.style.top)>=sheight*-1){
ns6div.style.top=parseInt(ns6div.style.top)-sspeed
setTimeout("ns6marquee(ns6div)",100)
}
else{
ns6div.style.top=sheight
ns6div.innerHTML=singletext[i]
if (i==singletext.length-1)
i=0
else
i++
}
}
// End -->
</script>

Dabrowski

5:00 pm on Aug 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Could you post the relevant HTML, and how exactly are you adding your second line of text?

mylittleopihi

8:57 pm on Sep 5, 2008 (gmt 0)

10+ Year Member



The section that I'm working on begins here .. you can see it in the script I posted.

singletext[0]='<div align="center"><font face=Arial size=2 color="black"><a href="news.html"><B> .......... CURRENT SCROLLING TEXT GOES HERE. I NEED TO SKIP LINE AND ADD NEXT SECTION OF SCROLLING TEXT ..........</a></font></div>'

In the past I would just add another <a href="#*$!">SECOND LINE OF NEWS TEXT</a> and it was fine.

Suddenly it doesn't work.

If you need more code to figure it out, it's the home page at accessurf.org

Thank you so much for your help. I'm volunteering my time with the organization and really want to help them out.

Dabrowski

11:58 pm on Sep 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm. If the script hasn't changed it would seem that the problem lies elsewhere. What exactly is the problem, are you getting a JavaScript error or is it simply not displayed?

The script seems to handle an array of messages, the second line of text should be added as follows:

singletext[0]='<div align="center"><font face=Arial size=2 color="black"><a href="news.html"><B> .......... CURRENT SCROLLING TEXT GOES HERE. NEED TO SKIP LINE AND ADD NEXT SECTION OF SCROLLING TEXT ..........</a></font></div>'
; <-- NOTE THE ; ON THE END!

singletext[1]='<div align="center"><font face=Arial size=2 color="black"><a href="something.html"><B> .......... SECOND LINE OF NEWS TEXT..........</a></font></div>';

mylittleopihi

9:06 pm on Sep 9, 2008 (gmt 0)

10+ Year Member



The scroller doesn't display at all when I add the second line of text.

Dabrowski

12:44 pm on Sep 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok I'll set up a test page and see if I can get it working.

Dabrowski

6:09 pm on Sep 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right, on a test page with the remaining HTML and JS copied from your website it works.

I used this setup:

singletext[0]='<div align="center"><font face=Arial size=2 color="black"><a href="news.html">The first thing</a></font></div>' 
singletext[1]='<div align="center"><font face=Arial size=2 color="black"><a href="news.html">The second thing</a></font></div>'

mylittleopihi

7:13 pm on Sep 17, 2008 (gmt 0)

10+ Year Member



Thank you so much for taking the time to help me with this!

If you're ever on Oahu, post me a head's up.