JavaScript code pops up the browser status bar text from right to left. JS Status Bar

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.