Home >Web Front-end >JS Tutorial >How to implement dynamic display of text in the status bar using javascript_javascript skills

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

WBOY
WBOYOriginal
2016-05-16 15:35:531404browse

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>

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

Statement:
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