Home > Web Front-end > JS Tutorial > Javascript method to achieve circular scrolling of status bar text from end to end_javascript skills

Javascript method to achieve circular scrolling of status bar text from end to end_javascript skills

WBOY
Release: 2016-05-16 15:49:19
Original
1431 people have browsed it

The example in this article describes the method of javascript to realize the circular scrolling of status bar text from end to end. Share it with everyone for your reference. The specific implementation method is as follows:

<html>
<head>
<title>中国风</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript">
<!--hide
var message="^_^欢迎光临本站!";
var position = 0;
var sta="";
var x=2*(60/message.length);
for(i=0;i<x;i++){
  sta+=message;
}
function statusScroll(){
  window.status=sta.substring(position,position+60);
  if(position++==60)
    position=0;
}
--hide-->
</script>
</head>
<body>
<script language="JavaScript">
setInterval("statusScroll()",150);
// 使用setInterval()按时间间隔调用函数
</script>
</body>
</html>

Copy after login

I hope this article will be helpful to everyone’s JavaScript programming design.

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