Date in the status bar : StatusBar « Window Browser « JavaScript DHTML






Date in the status bar

<HTML>
<HEAD>
<SCRIPT language="JavaScript">
<!--
function theclock(){
    var rightnow= new Date();
    
    var themonth= rightnow.getMonth();
    var today= rightnow.getDate();
    var theyear= rightnow.getYear();
    var thehours= rightnow.getHours();
    var themins= rightnow.getMinutes();
    var theseconds= rightnow.getSeconds();
    
    
    themonth+=1; //month number starts at 0
    
    //Set the Year Data for 4 Digits
    if (theyear<2000)
     theyear+=1900;
    
    if (thehours<10)
     thehours="0"+thehours;
    if (themins<10)
     themins="0"+themins;
    if (theseconds<10)
     theseconds="0"+theseconds;
    
    if (thehours<12)
     var ampm="AM";
    else
     var ampm="PM";
    
    if (thehours==0)
      thehours=12; 
    if (thehours>=13) 
     thehours-=12;
    
    window.status= themonth+"/"+today+"/"+theyear+" "+thehours+":"+themins+":"+theseconds+" "+ampm;
}

setInterval("theclock()",1000);

//-->
</SCRIPT>
</HEAD>
</HTML>


           
       








Related examples in the same category

1.Displays the time in the status line
2.Write text to the window's status bar
3.Using the self Property in status bar
4.Setting the Default Status Message
5.Links with Custom Statusbar Messages
6.Handling Status Message Changes
7.JavaScript display infomation in Status Bar
8.Working with Status Bar Messages
9.Using Status Messages
10.Scrolling Text in the Status Window
11.The onFocus event Handler
12. Creating a Scrolling Banner in status bar