본문 바로가기

카테고리 없음

[자바스크립트] [상태바] 브라우저 하단 상태바 글씨 타이포된 후 반복

<body>와 </body>부분에 넣어줍니다.
*****************************************
<script language="JavaScript">
<!--
  // Scrolling message settings
  var MessageText = "원하는 문구"
  var DisplayLength = 100 //글이 표시되는 폭
  var pos = 1 - DisplayLength;
  function ScrollInStatusBar(){
  var scroll = "";
  pos++;
  if (pos == MessageText.length) pos = 1 - DisplayLength;
  if (pos<0) {
   for (var i=1; i<=Math.abs(pos); i++)
   scroll = scroll + "";
       scroll = scroll + MessageText.substring(0, DisplayLength - i + 1);
  }
  else
      scroll = scroll + MessageText.substring(pos, pos + DisplayLength);
  window.status = scroll;
  //Scrolling speed
  setTimeout("ScrollInStatusBar()",0);
  }
  ScrollInStatusBar()
  //-->
  </script>