Watch on Status Bar

Hi dear friends here I have an interesting example related with digital watch .Most of the Business Requirement is time consuming to fulfill this type of Requirement on Server side code. So I have created in client side JavaScript code if you want to create a digital watch for your client .Don’t Bother about that I have an Example for You In JavaScript. Click here to Download Demo .

Code:
  1. <html>
  2. <head>
  3. <title>Digital Watch</title>
  4. <!--
  5. ///Author : Mohammad Usman
  6. ///Date :24/5/2011
  7. ///Title :Digital Watch
  8. -->
  9. <script "Do the work" language="Javascript">
  10. var timerID = null;
  11. var timerRunning = false;
  12. function stopclock (){
  13.  if(timerRunning)
  14.   clearTimeout(timerID);
  15.   timerRunning = false;
  16. }
  17. function showtime () {
  18.  var now = new Date();
  19.  var hours = now.getHours();
  20.  var minutes = now.getMinutes();
  21.  var seconds = now.getSeconds()
  22.  var timeValue = "" + ((hours >12) ? hours -12 :hours)
  23.  timeValue += ((minutes < 10) ? ":0" : ":") + minutes
  24.  timeValue += ((seconds < 10) ? ":0" : ":") + seconds
  25.  timeValue += (hours >= 12) ? " P.M." : " A.M."
  26.  window.status = timeValue+'   Developed By Mohammad Usman.' ;
  27.  timerID = setTimeout("showtime()",1000);
  28.  timerRunning = true;
  29. }
  30. function startclock () {
  31.  stopclock();
  32.  showtime();
  33. }
  34. </script>
  35. </head>
  36. <body onload="startclock ()">
  37. <center><H1>Welcome to Digital Watch</H1>
  38. <H3>See Your Status Bar.</h3>
  39. <H4>It Runs Only IE.</h4>
  40. </center>
  41. </body>
  42. </html>

Just Copy and Past above code to notepad and save with htm or html extension.(Like watch.htm).


1 comment:

Comment On Facebook