Wednesday, December 17, 2008

Display On Status Bar Of the Browser Window

Hi ...

Hi this time I am here with some easy wonder of java script . when you play with this I am sure you will enjoy this.

The 1st one is About :When we want to display the current Time in Status Bar. then You have to call the following java script function whereEver you need(Generally It will be called onload of the body in HTML)



function ShowTime()
{
var TimerKey
var now = new Date()
var Hours = now.getHours()
var Minutes = now.getMinutes()
var Seconds = now.getSeconds()
var TimeDisplay = document.getElementById("lblTime");
TimeDisplay.innerText = ((Hours > 12) ? Hours - 12 : Hours) + ((Minutes <> 12) ? " PM" : " AM")
window.status = ((Hours > 12) ? Hours - 12 : Hours) + ((Minutes <> 12) ? " PM" : " AM")
TimerKey = setTimeout("ShowTime()",1000)
}


var messageNum = 0;
function messageChanger()
{
if (messageNum ==0) {
defaultStatus = "Welcome to our Blog...";
messageNum = 1;
}
else
{
defaultStatus = "C#,JavaScript Articles";
messageNum = 0;
}
//Schedule the next message
setTimeout("messageChanger();", 3000);
}

And the 2nd one is About :When we want to display our Custom Message in Status Bar. then You have to call the following java script function whereEver you need(Generally It will be called onload of the body in HTML)

2.)


var messageNum = 0;
function messageChanger()
{
if (messageNum ==0) {
defaultStatus = "Welcome to our Blog...";
messageNum = 1;
}
else
{
defaultStatus = "C#,JavaScript Articles";
messageNum = 0;
}
//Schedule the next message
setTimeout("messageChanger();", 3000);
}

Thanks :

Sanjeev Chauhan

HelpOn Desk Team

1 comment:

helpondesk said...

Hi sanjeev this code is not compatible wiht mozila