|
|
|
|
Like this code?
Show the author your appreciation.
|
|
| |
With the help of JavaScript we can add our favorite message with the marquee effect.
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 create a new setStatusmessage() object and place a reference to it in the
variable scroll. We define a function function scroller() which scrolls our message.
First we add blank spaces before the message and reduce one space per loop.
Step 1 : Refresh the status message with setTimeout ('scroller()',scroll.delay).
Step 2 : Shift the message with scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length).
Step 3 : Create the message again ready to scroll.
| <SCRIPT language=JavaScript type="text/javascript">
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()
</SCRIPT> | | |
|
| Bouncing Marquee at Status Bar Categories : Java Script, HTML, Browsers | | | Builds JavaScript that updates the contents of one selector based on another. Categories : HTML, Java Script, PHP, Complete Programs, General | | | Javascript Background Scroller Categories : Java Script, CSS, HTML | | | How to create <SELECT> menues that change on the fly according to other <SELECT> menues on the page? Categories : Java Script, HTML | | | Get your browser details using javascript Categories : Java Script, Beginner Guides, Browsers | | | Prevent Right Mouse steal your graphics Categories : HTML, Java Script, Security | | | Cool tool tip Categories : Java Script, HTML, Web Design | | | Conditional Check - a script that allows a user to submit a form only if the user check a checkbox. Categories : HTML, Java Script, Form Processing, Beginner Guides | | | Javascript linked dropdowns Categories : Java Script, HTML, Classes and Objects | | | Javascript animated menu items Categories : DHTML, CSS, Java Script, HTML | | | Page Loading Message shown during the time your site's page is being loaded. Categories : HTML, CSS, Java Script | | | complete simply working javascript password generator file. Use letter, vowels, consonants (uppercase and lowercase) arrays to create a really random and secure password.
improved security using time functions to initialize random number generator. Categories : Java Script, HTML, Security, Authentication, Strings | | | Bookmarklets are simple tools that extend the surf and
search capabilities of Netscape and Explorer web browsers. Categories : Java Script, HTML, General | | | How to get the Focus (Cursor) into a Form-Element. Categories : HTML, Java Script | | | Higly Customizable Javascript Calendar Script Categories : Java Script, Calendar, Date Time, HTML, CSS | |
|
|
|