JavaScript Message Marquee at Status Bar of web browser

Saturday, 16 May 2009 17:47 Chetankumar Akarte
Print

JavaScript Message Marquee at Status Bar of web browser

With the help of JavaScript we can add our favorite message with marquee effect. First of all JavaScript Message Marquee at Status Bar of web browser.

For that we create an object with a constructor, a special type of function that prepares a new object for use by initializing the memory it takes up. Objects are created by applying the new operator to their constructors. This operator causes the constructor to which it is applied to create a brand-new object, and the nature of the object that is created is determined by the particular constructor that is invoked. Here we creates a new setStatusmessage() object and places a reference to it in the variable scroll. Here we define function function scroller() which scroll our message. Here first we add blank spaces before message and reduce one space per loop. And refresh status message by setTimeout('scroller()',scroll.delay). After shift all message by scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length). Then we make message again ready to scroll.

// More JavaScript - Visit: http://www.xfunda.com/
// JavaScript Message Marquee at Status Bar of web browser
<!--
var scroll = new setStatusmessage() 
 
function setStatusmessage() {
this.msg = "This is Scrolling Message...!!!"
this.out = " "
this.pos = 100 // how wide is the scroller?
this.delay = 50 // milliseconds between shifts
this.i = 0

 
function scroller() {
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.pos = 100
}
setTimeout ('scroller()',scroll.delay)
}
scroller()
// -->

JavaScript Message Marquee at Status Bar of web browser
JavaScript Message Marquee at Status Bar of web browser

Implementing Script

Implementation of script is quite simple just copy it and paste it any where in <head>--</head> or <body>--</body> section of your webpage.

 

Trackback(0)
Comments (0)Add Comment

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy
Last Updated ( Saturday, 16 May 2009 18:00 )