WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Bouncing Marquee at Status Bar
Categories : Java Script, HTML, Browsers
Chetankumar Akarte
Date : Dec 05th 2006
Grade : 4 of 5 (graded 5 times)
Viewed : 7841
File : 4546.zip
Images : Image 1
Search : More code by Chetankumar Akarte
Action : Grade This Code Example
Tools : My Examples List

 
Like this code?
Show the author your appreciation.
Submit your own code examples 
 

In this example I show how to add a bouncing message at the status bar of the browser.
Define the next variables :

o data - contains a message to be displayed
o limit - bounce limit
o message1
o direction
o speed

The function bounce() contains an if-else condition that bounces the message left or right.
To shift the message left we add two spaces to message1 and assign the value to message2 :

message2=message1.substring(2,message1.length)+"  ";


and display it at the status bar by

window.status=message2;


We refresh the message with

setTimeout("bounce();",speed);


and repeat the process.

As we reach ‘*’

if (message1.substring(0,1) == "*" ) direction="right";


we set the direction to the right so the else condition is satisfied and we subtract two spaces from message1 and assign the value to message2 :

message2="  "+message1.substring(0,message1.length-2);


and display it at the status bar with :

window.status=message2;


And repeat process to ‘*’ and set direction to the left :

if (message1.substring(message1.length-1,message1.length) == "*")  direction="left";


in this way we can bounce our message at the status bar


Full Code
<SCRIPT language=JavaScript type="text/javascript">
<!--
var data = " My  Bouncing  Message ... !!!  ";    // Message to be display
var limit="                        ";    // define bounce limit
var message1=limit+'*'+data+'*'+limit;
var direction = "left";
var speed = 75;

function bounce()
{
if (direction == "left")
  {
    message2=message1.substring(2,message1.length)+"  ";
    window.status=message2;
    setTimeout("bounce();",speed);
    message1=message2;
    if (message1.substring(0,1) == "*")
     direction="right";
  }
else
  {
    message2="  "+message1.substring(0,message1.length-2);
    window.status=message2;
    setTimeout("bounce();",speed);
    message1=message2;
    if (message1.substring(message1.length-1,message1.length) == "*")
     direction="left";
  }
}
bounce()
// -->
</SCRIPT>



Message Marquee at Status Bar
Categories : Java Script, HTML, Browsers
Javascript Background Scroller
Categories : Java Script, CSS, HTML
hick
Categories : HTML, Java Script
Get your browser details using javascript
Categories : Java Script, Beginner Guides, Browsers
Clock at Status Bar
Categories : Java Script, HTML, Date Time
Prevent Right Mouse steal your graphics
Categories : HTML, Java Script, Security
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
Table editable dynamic form with edit + selection (select / option) + checkbox.
Categories : Java Script, DHTML, User Interface, CSS, HTML
Builds JavaScript that updates the contents of one selector based on another.
Categories : HTML, Java Script, PHP, Complete Programs, General
Javascript Color Picker
Categories : Java Script, Colors, HTML
Mordern Peroidic Table - Science
Categories : Java Script, HTML, Charts and Graphs
Cool tool tip
Categories : Java Script, HTML, Web Design
Java Script Based Navigation
Categories : HTML, Java Script, Navigation
Unobtrusive javascript for maintaining scrollable layer state
Categories : DHTML, Java Script, HTML
Higly Customizable Javascript Calendar Script
Categories : Java Script, Calendar, Date Time, HTML, CSS