JavaScript code pops up the browser status bar text from right to left. JS Status Bar
This article describes how javascript can bring up text in the browser status bar from right to left. We will share this with you for your reference. The details are as follows:
The code in the status bar is displayed from right to left. You can modify the code snippets in the Script to change the effect:
Var POSITION = 100
Var DELAY = 4
Var MESSAGE = "here is the text you want! "
The running effect is as follows:
The Online Demo address is as follows:
Http://demo.jb51.net/js/2015/js-status-bar-txt-scroll-codes/
The Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN"> <HTML> <HEAD> <TITLE> Status Bar text pop-up code, </TITLE> </HEAD> <BODY> <script language = "JavaScript"> <! -- Function statusMessageObject (p, d) {this. msg = MESSAGE this. out = "" this. pos = POSITION this. delay = DELAY this. I = 0 this. reset = clearMessage} function clearMessage () {this. pos = POSITION} var POSITION = 100var DELAY = 4 var MESSAGE = "the status bar text is displayed one by one quickly !!! "Var scroll = new statusMessageObject () function scroroller () {for (scroll. I = 0; scroll. I <scroll. pos; scroll. I ++) {scroll. out + = ""} if (scroll. pos> = 0) scroll. out + = scroll. msg else scroll. out = scroll. msg. substring (-scroll. pos, scroll. msg. length) window. status = scroll. out scroll. out = "" scroll. pos -- if (scroll. pos <-(scroll. msg. length) {scroll. reset ()} setTimeout ('scroller () ', scroll. Delay)} function snapIn (jumpSpaces, position) {var msg = scroll. msg var out = "" for (var I = 0; I <position; I ++) {out + = msg. charAt (I)} for (I = 1; I <jumpSpaces; I ++) {out + = ""} out + = msg. charAt (position) window. status = out if (jumpSpaces <= 1) {position ++ if (msg. charAt (position) = '') {position ++} jumpSpaces = 100-position} else if (jumpSpaces> 3) {jumpSpaces * =. 75} else {jumpSpaces --} if (Position! = Msg. length) {var cmd = "snapIn (" + jumpSpaces + "," + position + ")"; scrollID = window. setTimeout (cmd, scroll. delay);} else {window. status = "" jumpSpaces = 0 position = 0 cmd = "snapIn (" + jumpSpaces + "," + position + ")"; scrollID = window. setTimeout (cmd, scroll. delay); return false} return true} snapIn (100,0); // --> </script> </BODY> </HTML>
I hope this article will help you design JavaScript programs.