|
-
Jan 19th, 2005, 10:27 AM
#1
Thread Starter
Addicted Member
Smooth Scrolling Text
I've got some script here that can scroll text in an asp:textbox, but it is not smooth as it just jumps left by a character everytime. Does anyone know where I can get free smooth scrolling javascript?
Here is my code if anyone has any suggestions on how I can make it scroll smoother:
Code:
<SCRIPT LANGUAGE="JavaScript">
//SCROLLING TEXT BEGIN
var message=document.all['display'].value;
var spc=10;
var speedisplay=250;
var rows=1;
var cols=40;
var len=spc*2;
var text=message;
var i;
var stop=false;
for (i=0;i<spc;i++)
{
text=text+" ";
}
function array(n)
{
this.length = n
for (i=1; i <= n; i++)
{
this[i] ="";
}
return this;
}
var l=text.length;
var ll=message.length;
var lb=new array(l)
var lr=new array(spc*2+1)
var lg=new array(ll)
var lk=new array(ll)
lb[0]=text;
lb[l]=text;
lr[0]=message;
lg[0]=message;
for (j=1;j<l;j++)
{
lb[j]=lb[j-1].substring(1, l)+lb[j-1].charAt(0);
}
var i=ll;
function t()
{
if(i>l)
{
i=1;
}
document.all['display'].value=lb[i];
i++;
setTimeout("t()",speedisplay)
}
if (rows<=spc&&rows<=ll&&spc+ll<=cols)
{
t();
}
//SCROLLING TEXT END
</SCRIPT>
There are a few variables declared that I do not use, as I've had to shorten this code. I got this from http://javascript.internet.com/scrolls/text-effect.html
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|