Displays the time in the status line : StatusBar « Window Browser « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Dojo toolkit
7. Event
8. Event onMethod
9. Ext JS
10. Form Control
11. GUI Components
12. HTML
13. Javascript Collections
14. Javascript Objects
15. Javascript Properties
16. jQuery
17. Language Basics
18. Mochkit
19. Mootools
20. Node Operation
21. Object Oriented
22. Page Components
23. Rico
24. Scriptaculous
25. Security
26. SmartClient
27. Style Layout
28. Table
29. Utilities
30. Window Browser
31. YUI Library
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
JavaScript DHTML » Window Browser » StatusBar 
Displays the time in the status line

/*
Examples From
JavaScript: The Definitive Guide, Fourth Edition

Legal matters: these files were created by David Flanagan, and are
Copyright (c) 2001 by David Flanagan.  You may use, study, modify, and
distribute them for any purpose.  Please note that these examples are
provided "as-is" and come with no warranty of any kind.

David Flanagan
*/
<html>
<head>
<script>
// This function displays the time in the status line.
// Invoke it once to activate the clock; it will call itself from then on.
function display_time_in_status_line()
{
    var d = new Date();                // Get current time.
    var h = d.getHours();              // Extract hours: 0 to 23.
    var m = d.getMinutes();            // Extract minutes: 0 to 59.
    var ampm = (h >= 12)?"PM":"AM";    // Is it am or pm?
    if (h > 12h -= 12;               // Convert 24-hour format to 12-hour.
    if (h == 0h = 12;                // Convert 0 o'clock to midnight.
    if (m < 10m = "0" + m;           // Convert 0 minutes to 00 minutes, etc.
    var t = h + ':' + m + ' ' + ampm;  // Put it all together.

    defaultStatus = t;                 // Display it in the status line.

    // Arrange to do it all again in 1 minute. 
    setTimeout("display_time_in_status_line()"60000)// 60000 ms is 1 minute.
}
</script>
</head>
<!-- Don't bother starting the clock till everything is loaded. The
  -- status line will be busy with other messages during loading, anyway. -->
<body onload="display_time_in_status_line();">
<!-- The HTML document contents go here. -->
</body>
</html>


           
       
Related examples in the same category
1. Date in the status bar
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
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.