Click to See Complete Forum and Search --> : non-coder needs help with client request


paigeturner
11-05-2003, 09:11 PM
my client has requested a single line - left to right - typewriter scroller on his home page.

I found one that he likes and we now need to find a way to stop the crazy thing after 3 or 4 repeats of his message. (my client does not want to have the customer click on the banner in order to pause/stop the movement :(

I have a feeling it's a loop= but don't know enough about java coding to go beyond that and modify the existing code to implement the action and have it work.

Additionally, he wants the first line (Msg [0] Everything you need to attract wild birds to your backyard) of the scrolling messsage to remain on the page after the scrolling has stopped.

I have copied the code (along with the credits for the designer of the code) in this message.

Any assistance you can give will be greatly appreciated.

Many thanks in advance

Paige
----------------------------------------------------------------
/* This script created by Jim Young of www.requestcode.com
where you can find free scripts and help with your JavaScript problems.
Please leave this comment in.

You will have to play with the positioning, width and height of the div. The width will depend
on how long your message is. If you want more of a pause between messages then add
more spaces to the end of the messages.

Enter the messages you want displayed here
*/
var msg=new Array()
msg[0]="Everything you need to attract Wild Birds to your backyard!
"
msg[1]="BirdhousesPLUS...BirdseedPLUS...BirdbathsPLUS...BooksPLUS... "

msg[2]="AccessoriesPLUS...BirdfeedersPLUS...all at the best prices! "

// This sets the speed at which the letters of the message are displayed
speed=125
a=0
temp=""
arrlen=msg.length
i=0
function Scrollbox()
{
if(i>=arrlen)
{i=0}
len=msg[i].length
temp=temp+msg[i].substr(a,1)
/* If you want a different font and color then change it here in Both places */
if(document.getElementById)
{
elm=document.getElementById("scrolltext")
elm.innerHTML="<FONT face='Arial' color='blue'><b>"+temp+"</b></FONT>"
}
else
{
if(document.layers)
{
document.scrolltext.document.write("<FONT face='Arial' color='blue' weight='bold'><b>"+temp+"</b></FONT>")
document.scrolltext.document.close()
}
}
a++
if(a<len)
{counts=setTimeout("Scrollbox()",speed)}
else
{
a=0
if(document.getElementById)
{elm.innerHTML=" "}
else
{
document.scrolltext.document.write(" ")
document.scrolltext.document.close()
}
temp=""
i++
counts=setTimeout("Scrollbox()",speed)
}
}

migwich
11-12-2003, 10:41 PM
Hi paigeturner,
I kicked around your code for a bit and attached a modified version of the code you posted. It is a TXT file, but you can change the extension to .HTM and it should work. Is it what you were looking for?

paigeturner
11-13-2003, 06:57 AM
Woot!! :D Migwich you're a genius!!

Thanks so much for your help and the awesome job you did on correcting the code. My client is thrilled, as am I.

All my best to you,

Paige

migwich
11-13-2003, 09:40 AM
Glad I could help. :)