Introduction
In this section we see how to add bouncing message at status bar of browser. So we define variables data contain message to be display, limit define bounce limit, message1, direction, speed. Now define function bounce() contain if-else condition helps to bounce message left or right. To shift message left we add two spaces to message1 and assign to message2 message2=message1.substring(2,message1.length)+" "; and display it at status bar by window.status=message2;. We refresh message by setTimeout("bounce();",speed); repeat the process. As we reach to ‘*’ if (message1.substring(0,1) == "*" ) direction="right"; set direction to right so else condition satisfy and we subtract two spaces from message1 and assign to message2 message2=" "+message1.substring(0,message1.length-2); and display it at status bar by window.status=message2;. And repeat process to ‘*’ and set direction to left if (message1.substring(message1.length-1,message1.length) == "*") direction="left"; in this way we can bounce our message at status bar
Source Code
<SCRIPT language=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>
Summary This artical gives an idea to add Bouncing Marquee at Status Bar of Web Browser
|
No responses found. Be the first to respond and make money from revenue sharing program.
|