[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Svrolling text bar
> I know that there is a java applet that creates a text bar with
> scrolling text, but is there a javascript out there that does the same
> thing?
There's a little script that's been floating around lately that lets you
scroll text in a form's text field or the window's status bar. This is
a modified version:
<SCRIPT LANGUAGE="JavaScript">
<!--
function scrollmsg(seed)
{
var m1 = "HTML Forms Imagemaps CGI ";
var m2 = "Perl Advanced Applications ";
var m3 = "Servers WWW Newsgroups Local Info ";
// Change the above to the message you want to see scrolled.
var msg=m1+m2+m3;
var out = "";
var c = 0;
if (seed > 100) {
seed--;
var cmd="scrollmsg(" + seed + ")";
timerTwo=window.setTimeout(cmd,110);
// Increase the number to make it slower, decrease ^ it to make it faster.
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
var cmd="scrollmsg(" + seed + ")";
document.display.box.value=out;
// Change "display" to the name of your form, and "box" to the name of
// the text box in the form. Or if you want to scroll on the status bar
// use:
// self.status=out;
timerTwo=window.setTimeout(cmd,110);
// Increase to make slower, decrease to make faster...or use
}
else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
var cmd="scrollmsg(" + seed + ")";
document.display.box.value=out;
// Change "display" and "box" or use:
// self.status=out;
timerTwo=window.setTimeout(cmd,110);
// Increase to make slower...
}
else {
document.display.box.value=" ";
// Change the above line or use:
// self.status=" ";
timerTwo=window.setTimeout("scrollmsg(15)",110);
// Change "15" to width of text field or width of status bar (100)
}
}
}
// -- End of JavaScript code -------------- -->
</SCRIPT>
** Put this in your BODY tag:
onLoad="timerONE=window.setTimeout('scrollmsg(15)',500)"
(change 15 to the width of the text field in your form, or make it
100 if you want to scroll a message across the bottom status bar)
** Here's a the sample form used with this script.
<form name="display">
<input type="text" name="box" value="" size="15"><br>
</form>
I didn't originally write the script, don't credit me. I forget who did,
but they gave permission for its use.