Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> This is an example of dynamic JavaScript text display </title>
<script type= "Text/javascript" >
var POSITION = 50;
var DELAY = 150;
var message = "This is an example of dynamic JavaScript text display";
function Bannerobject () {
this.msg = message;
This.out = "";
This.pos = POSITION;
This.delay = delay;
this.i = 0;
This.reset = Clearmessage;
}
function Clearmessage () {
This.pos = POSITION;
}
var scroll = new Bannerobject ();
function Scroller () {
Scroll.out + = "";
if (scroll.pos>0)
for (scroll.i = 0; scroll.i < Scroll.pos; scroll.i++) {
Scroll.out + = "";
}
if (scroll.pos>= 0)
Scroll.out + = scroll.msg;
Else
Scroll.out = scroll.msg.substring (-scroll.pos,scroll.msg.length);
Document.noticeForm.notice.value = Scroll.out;
Scroll.out = "";
scroll.pos--;
scroll.pos--;
if (Scroll.pos <-(scroll.msg.length)) {
Scroll.reset ();
}
Window.settimeout ("Scroller ()", scroll.delay);
}
</script>
<body onload= "scroller ()" bgcolor= "#000000" link= "#C0C0C0" vlink= "#C0C0C0" alink= "#008080" text= "#C0C0C0" >
<table border= "0" cellspacing= "0" cellpadding= "0" >
<TR><TD width= "100%" >
<form name= "Noticeform" action= "" >
<p><input type= "text" name= "notice" size= "" style= "Background-color:rgb" (192,192,192) "/></p>"
</form>
</td></tr>
</table>
</body>
Scrolling text in the status bar
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> This is a marquee effect of the JavaScript document-in the status bar </title>
<script type= "Text/javascript" >
var msg = "This is a marquee effect of the JavaScript document";
var interval = 100;
var spacelen = 120;
var space10 = "";
var seq = 0;
function Scroll () {
len = msg.length;
Window.status = msg.substring (0, seq + 1);
seq++;
if (seq >= len) {
seq = Spacelen;
Window.settimeout ("Scroll2 ();", interval);
}
Else
Window.settimeout ("Scroll ();", interval);
}
function Scroll2 () {
var out = "";
for (i = 1; I <= spacelen/space10.length; i++)
Out +=space10;
out = out + msg;
len = out.length;
Window.status = out.substring (seq, Len);
seq++;
if (seq >= len) {seq = 0;};
Window.settimeout ("Scroll2 ();", interval);
}
Scroll ();
</script>
<body>
</body>