Home > Web Front-end > JS Tutorial > body text

JS implements status bar ticker text effect code_javascript skills

WBOY
Release: 2016-05-16 15:35:27
Original
1648 people have browsed it

The example in this article describes the JS code to implement the status bar ticker text effect. Share it with everyone for your reference, the details are as follows:

In this status bar ticker, the text running is defined in an array, and you can modify the content yourself. The current IE8 seems to be incompatible, and there are defective codes. JS enthusiasts are welcome to correct them. Please send back a copy of the corrections. The status bar is the effect display area.

The screenshot of the running effect is as follows:

The online demo address is as follows:

http://demo.jb51.net/js/2015/js-ztlpmd-txt-style-codes/

The specific code is as follows:

<HTML>
<HEAD>
<TITLE>间隔状态栏跑马灯</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<SCRIPT language=JavaScript>
<!--
function scrollit(seed) {
var m1 = "HI:你 好! ";
var m2 = "欢迎访问脚本之家网站";
var m3 = "请 多 提 意 见,谢 谢!";
var m4 = "E-MAIL:";
var m5 = "/";
var msg=m1+m2+m3+m4+m5;
var out = " ";
var c = 1;
if (seed > 100) {
seed--;
cmd="scrollit("+seed+")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 100 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
window.status=out;
cmd="scrollit("+seed+")";
timerTwo=window.setTimeout(cmd,100);
}
else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
window.status=out;
cmd="scrollit("+seed+")";
timerTwo=window.setTimeout(cmd,100);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scrollit(100)",75);
}
}
}
//-->
</SCRIPT>
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
</HEAD>
<BODY bgColor=#fef4d9 onload=scrollit(100)>
</BODY>
</HTML>
Copy after login

I hope this article will be helpful to everyone in JavaScript programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!