Home > Web Front-end > JS Tutorial > body text

How to implement dynamic display of text in the status bar using javascript_javascript skills

WBOY
Release: 2016-05-16 15:35:53
Original
1369 people have browsed it

The example in this article describes the method of dynamically displaying text in the status bar using JavaScript. Share it with everyone for your reference, the details are as follows:

<script>
 var child = window.open("information.html","_blank","width=200,height=200,toolbar=no");
 function closeChild(){
 if(!child.closed){
  child.close();
 }
 }
 //设置间隔1秒钟,调用一次scroll()
 setInterval("scroll()",100)
 var space_num = 0;
 var dir = 1; //文本开始从左向右移动
 function scroll(){
 var str_space = "";
 space_num = space_num + 1*dir;
 //如果空格数大于40 或者 小于0时
 if(space_num > 40 || space_num <= 0){
  dir = dir * (-1);
 }
 //空格数自增
 for(var i=0; i<space_num; i++){
  str_space += " ";
 }
 //在文字前空格数变换
 window.status = str_space + "welcome to study";
 }
</script>
<body onunload="closeChild()">
</body>

Copy after login

I hope this article will be helpful to everyone in JavaScript programming.

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