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.