Click here to Skip to main content
Licence CPOL
First Posted 6 Oct 2004
Views 44,524
Bookmarked 6 times

How to Display Text in Status bar

By | 6 Oct 2004 | Article
How to Display Text in Status bar

Disclaimer

This source code is written and maintained by an individual, not a company. It has been provided for free to the Microsoft .NET user community with the expectation that users will take whatever action necessary to get the code to operate according to their needs. This includes debugging and enhancements. The source code is provided "as is" and there are neither warrantees to the quality of the work nor any expressed or implied agreements that the programmer will release any updates. The programmer will release updates and provide any support at his own discretion.

Introduction

The Article is mainly for Beginners of JavaScript writers. In this article I have shown how to display a text message in the status bar and I also given the code for right click protected Screen. Actually it is a simple and a easy one. The developers can easily use this code in the application, which they develop. What you have to do is just copy paste in the your application.

How it works

It will keep on running in the status bar of the browser window in which page the script is added.

The Following is the code for displaying running text in the status bar.

<script language="JavaScript">
<!--function scrollit_r2l(seed) {
/* ---- Variables ---- */
var m0 = " Vivek's JS sample Gallery"; 
   /* Text Msg to be Displayed */
var m1 = " - JavaScript A best scripting language i ever seen"; 
   /* Text Msg to be Displayed */
var m2 = " - , Hello!!! "; /* Text Msg to be Displayed */
var m3 = " - , Human Intelligence"; /* Text Msg to be Displayed */
var msg=m0 + m1 + m2 + m3;
var out= " "; // Autocomplete Timeout in ms 
var c = 1;
if (seed > 99) {
seed--;
var cmd="scrollit_r2l(" + seed + ")";
timerTwo=window.setTimeout(cmd,99);
}
else if (seed <= 99 && seed > 0) {
for (c=0 ; c < seed ; c++) {
out+=" ";
}
out+=msg;
seed--;
var cmd="scrollit_r2l(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,99);
}
else if (seed <= 0) {
if (-seed < msg.length) {
out+=msg.substring(-seed,msg.length);
seed--;
var cmd="scrollit_r2l(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,99);
}
else {
window.status=" ";
timerTwo=window.setTimeout("scrollit_r2l(100)",75);
}
}
}
timeONE=window.setTimeout('scrollit_r2l(100)',500); // -->
</script>

And I hope you all enjoy the above code.

The next code is for right click protected screen.

<script language="JavaScript">
message = "Sample JS free to study + Help + More^" +
"^"
scrollSpeed = 25 // Setting the speed of the
  // Txt to be displayed in the status bar
lineDelay = 1500
txt = ""
function scrollText(pos) {
if (message.charAt(pos) != '^') {
txt = txt + message.charAt(pos)
status = txt
SP = scrollSpeed
}
else {
SP = lineDelay
txt = ""
if (pos == message.length-1) pos = -1
}
pos++
setTimeout("scrollText('"+pos+"')",SP)
}
scrollText(0)
function right(e) {
if (navigator.appName == 'Netscape' &&
(e.which == 3 || e.which == 2)) // Validating the browser
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(event.button == 2 || event.button == 3)) {
alert("This is 'Right Click' Protected Screen"); // Alert Msg by User 
return false;
}
return true;
}
document.onmousedown=right;
</script>

How to Include in Your web page

Include the .js file into your script:

<script language="javascript" type="text/javascript" src="filename.js"></script>

Or just copy all the lines of above code and paste in the html area

<html>
<title>
<script language="javascript"></script>
</title>
</html>

And I hope you all enjoy the above code also.

For more help and queries please mail me vivekthangaswamy@gmail.com

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

vivekthangaswamy

Architect

India India

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralThis will not work on Firefox w/out pref change Pinmemberxler8_x10:50 21 Sep '07  
Generalmelting... Pinmemberf214:52 7 Oct '04  
Generalamazing... Pinmemberl a u r e n13:07 7 Oct '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 7 Oct 2004
Article Copyright 2004 by vivekthangaswamy
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid