9、状态栏文字慢慢滑动

9、状态栏文字慢慢滑动

<SCRIPT LANGUAGE="JavaScript">

<!-- hide script from old browsers

var phrase = "精彩javascript特效,欢迎你的光临!!!";

var lenPhrase = phrase.length;

var phraseOut = "";

var pause = 25;

var i=0;

var j=0;

var animateWidth = 20;

var position=animateWidth;

function stack() {

    if (phrase.charAt(i) != " ") {

      phraseOut = "";

      for (j=0; j<i; j++) {

        phraseOut += phrase.charAt(j);

      }

      for (j=i; j<position; j++) {

        phraseOut += " ";

      }

      phraseOut += phrase.charAt(i);

      for (j=position; j<animateWidth; j++) {

        phraseOut += " ";

      }

      window.status = phraseOut;

      if (position == i) {

        animateWidth++;

        position = animateWidth;

        i++;

      }

      else {

        position--;

      }

    }

    else {

      i++

    }

    if (i<lenPhrase) {

        setTimeout("stack()",pause);

    }

}

// end hiding contents -->

</SCRIPT>

</head>

 

<body OnLoad="stack()">

Write a comment

Comments: 0