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 .
Just Copy and Past above code to notepad and save with htm or html extension.(Like watch.htm).
Code:
- <html>
- <head>
- <title>Digital Watch</title>
- <!--
- ///Author : Mohammad Usman
- ///Date :24/5/2011
- ///Title :Digital Watch
- -->
- <script "Do the work" language="Javascript">
- var timerID = null;
- var timerRunning = false;
- function stopclock (){
- if(timerRunning)
- clearTimeout(timerID);
- timerRunning = false;
- }
- function showtime () {
- var hours = now.getHours();
- var minutes = now.getMinutes();
- var seconds = now.getSeconds()
- var timeValue = "" + ((hours >12) ? hours -12 :hours)
- timeValue += ((minutes < 10) ? ":0" : ":") + minutes
- timeValue += ((seconds < 10) ? ":0" : ":") + seconds
- timeValue += (hours >= 12) ? " P.M." : " A.M."
- window.status = timeValue+' Developed By Mohammad Usman.' ;
- timerID = setTimeout("showtime()",1000);
- timerRunning = true;
- }
- function startclock () {
- stopclock();
- showtime();
- }
- </script>
- </head>
- <body onload="startclock ()">
- <center><H1>Welcome to Digital Watch</H1>
- <H3>See Your Status Bar.</h3>
- <H4>It Runs Only IE.</h4>
- </center>
- </body>
- </html>
Just Copy and Past above code to notepad and save with htm or html extension.(Like watch.htm).
thaks
ReplyDelete