用JAVASCRIPT实现的几个常用小特效(一)
大家一定经常见到有的网页在下面的状态条里有一行字在不停地游走,这种特效是怎么实现的呢?请看下面这段源码:
<!-- Status Bar Scroller start here! -->
<SCRIPT LANGUAGE="JavaScript">

var speed=300;
function infoscroll(seed,looped)
{
var t0="'这儿是你要显示的信息‘"
 var msg=""+t0;
 var putout = " ";
 var c  = 1;

 if (looped > 10)
 { window.status="<Thanks !>"; }
 else if (seed > 100)
 {
   seed--;
   var cmd="infoscroll(" + seed + "," + looped + ")";
   timerTwo=window.setTimeout(cmd,speed);
 }
 else if (seed <= 100 && seed > 0)
 {
  for (c=0 ; c < seed ; c++)
  { putout+=" "; }
  putout+=msg.substring(0,100-seed);
  seed--;
  var cmd="infoscroll(" + seed + "," + looped + ")";
  window.status=putout;
  timerTwo=window.setTimeout(cmd,speed);
 }
 else if (seed <= 0)
 {
  if (-seed < msg.length)
  {
   putout+=msg.substring(-seed,msg.length);
   seed--;
   var cmd="infoscroll(" + seed + "," + looped + ")";
   window.status=putout;
   timerTwo=window.setTimeout(cmd,speed);
  }
  else
  {
   window.status=" ";
   looped += 1;
   var cmd = "infoscroll(100," + looped + ")";
   timerTwo=window.setTimeout(cmd,speed);
  }
 }
}
// -->

<!--
infoscroll(100,1)
// -->
</SCRIPT>
<!-- End of Status Bar Scroller 1.0-->