<!--要完成此效果需要两个步骤
第一步:把如下代码加入到<head>区域中-->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function mklist(n)
{
this.length=n;
for (var c=1 ; c <= n ; c++) {
this[c]=0;
}
return this;
}
function browserdelay()
{
var retval=500;
if (navigator.userAgent.indexOf("Win") != 0) {
retval=150;
}
else if (navigator.userAgent.indexOf("Mac") != 0) {
retval=500;
}
else if (navigator.userAgent.indexOf("X11") != 0) {
retval=750;
}
return retval;
}
function mkcfg(n)
{
this.num=1;
this.seed=0;
this.list=new mklist(n);
this.type=new mklist(n);
this.delay=browserdelay();
this.timer=0;
this.showurl=(5 * 1000);
this.looping=true;
this.msgdisp=(4 * 1000);
this.barwidth=100;
return this;
}
function urlfix(obj)
{
window.clearTimeout(window.config.timer);
window.defaultStatus=obj.href;
window.config.timer=window.setTimeout("sbprint()",window.config.showurl);
return true;
}
function scrollit_r2l()
{
var out=" ";
var c=0;
if (window.config.seed <= window.config.barwidth && window.config.seed > 0) {
for (c=0 ; c < window.config.seed ; c++) {
out+=" ";
}
out+=window.config.list[window.config.num];
window.config.seed--;
window.status=out;
window.config.timer=window.setTimeout("scrollit_r2l()",window.config.delay);
}
else if (window.config.seed <= 0) {
if (-window.config.seed < window.config.list[window.config.num].length) {
out+=window.config.list[window.config.num].substring(-window.config.seed,window.config.list[window.config.num].length);
window.config.seed--;
window.status=out;
window.config.timer=window.setTimeout("scrollit_r2l()",window.config.delay);
}
else {
window.status=" ";
window.config.num++;
window.config.timer=window.setTimeout("sbprint()",window.config.msgdisp);
}
}
}
window.config=new mkcfg(7);
window.config.list[1]="这里改写你的第一条信息";
window.config.type[1]=0;
window.config.list[2]="这里改写你的第二条信息";
window.config.type[2]=0;
window.config.list[3]="这里改写你的第三条信息";
window.config.type[3]=0;
window.config.list[4]="这里改写你的第四条信息";
window.config.type[4]=0;
window.config.list[5]="这里改写你的第五条信息";
window.config.type[5]=0;
window.config.list[6]="这里改写你的第六条信息";
window.config.type[6]=0;
window.config.list[7]="这里改写你的第七条信息";
window.config.type[7]=0;
function sbprint()
{
if (window.config.num <= window.config.list.length) {
if (window.config.type[window.config.num] == 0) {
window.status=window.config.list[window.config.num];
window.config.num++;
window.clearTimeout(window.config.timer);
window.config.timer=window.setTimeout('sbprint()',window.config.msgdisp);
}
else if (window.config.type[window.config.num] == 1) {
window.config.seed=window.config.barwidth;
scrollit_r2l();
}
}
else if (window.config.looping) {
window.config.num=1;
window.clearTimeout(window.config.timer);
window.config.timer=window.setTimeout('sbprint()',window.config.delay);
}
}
// End -->
</script>
<!--第二步:把“onload="window.config.timer=window.setTimeout('sbprint()',window.config.delay);"”加在<body>区域中-->
<body onload="window.config.timer=window.setTimeout('sbprint()',window.config.delay);">