473,396 Members | 2,038 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

My Digital Clock sometimes works and sometimes not :(

dmjpro
2,476 2GB
Expand|Select|Wrap|Line Numbers
  1. <body onload="setDynColck()">
  2.  
  3. <input type='hidden' id='millsecs' value='Capturing the milliseconds from server side'/>
  4.  
  5. /*******
  6. Some server side coding to manipulate the current time
  7. **************/
  8.  
  9. <td align="center" id="hour1" class="searchbgcolor"><%=First Digit of Hour%></td><td align="center" id="hour2" class="searchbgcolor"><%=Second Digit of Hour%></td>
  10.                     <td align="center" class="searchbgcolor">.</td>
  11.                     <td align="center" id='minute1' class="searchbgcolor"><%=First Digit of Minute%></td><td align="center" id='minute2' class="searchbgcolor"><%=Second Digit of Minute%></td>
  12.  
  13.  
Expand|Select|Wrap|Line Numbers
  1. function setDynColck(){
  2.                 setInterval(showDynClock,60000);
  3.             }
  4.  
  5. function showDynClock(){
  6.                 var img_hour1 = document.getElementById('hour1');
  7.                 var img_hour2 = document.getElementById('hour2');
  8.                 var img_minute1 = document.getElementById('minute1');
  9.                 var img_minute2 = document.getElementById('minute2');
  10.  
  11.                 var milliseconds = document.getElementById('millsecs').value;
  12.                 var current_mill = parseInt(milliseconds,10)+60000;
  13.                 document.getElementById('millsecs').value = current_mill;
  14.                 var current_date = new Date();
  15.                 current_date.setTime(current_mill);
  16.  
  17.                 var hour_str = (current_date.getHours()<10?"0":"")+current_date.getHours();
  18.                 var minute_str = (current_date.getMinutes()<10?"0":"")+current_date.getMinutes();
  19.  
  20. img_hour1.innerHTML = hour_str.charAt(0);
  21.                 img_hour2.innerHTML = hour_str.charAt(1);
  22.                 img_minute1.innerHTML = minute_str.charAt(0);
  23.                 img_minute2.innerHTML = minute_str.charAt(1);
  24.             }
  25.  
I am changing the time at client side at 1 minute interval. Is there any wrong logic?
Feb 11 '09 #1
4 1357
acoder
16,027 Expert Mod 8TB
What does "not working" mean? What happens?
Feb 11 '09 #2
dmjpro
2,476 2GB
Did you go through the logic fully?
What you think ..is that right ?

Some times the output showing wrong.
Can you test it on your machine using any Server side scripting?
Feb 11 '09 #3
acoder
16,027 Expert Mod 8TB
View the source in the browser and post some sample time data instead, so I can test that.
Feb 11 '09 #4
hsriat
1,654 Expert 1GB
@dmjpro
Seems to work without any problem.
Feb 14 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: melanieab | last post by:
Hi again, I'm trying to draw a digital clock in the corner of a picturebox whenever a particular tabpage is in focus. I either need to be able to make the clock keep real time (I can get it to...
8
by: HalcyonWild | last post by:
Hi, I installed the free version(command line only) of the digital mars c++ compiler. It said it features a garbage collection mechanism, but there was no documentation. I figured out that...
5
by: biltz | last post by:
hey...wanna source code of...digital clock by using nested for loop..if anybody know plzzzzzzzzzz...help me...i m getting eror in it..not sure wt do ....:(
4
by: 511475 | last post by:
Hi: I am an retired school teacher who went back to school for the fun of it. my subjects were computer hardware. I am taking a course in javascript and it is about to get the better of me. I...
24
by: mohsinalishah444 | last post by:
Dear All, PLZ TELL ME THE SOURCE CODE OF DIGITAL CLOCK IN C LANGUAGE . I REALLY NEED IT AND I DONOT KNOW HOW TO USE C LANGUAGE . ACTUALLY I WANT TO MAKE A CLOCK IN LINUX >IF ANY BODY POST ME THE...
10
by: novuseden | last post by:
i need to make a digital clock for my computer class that looks like this http://pheatt.emporia.edu/courses/2007/cs220f07/assignment04/assignment04.htm plz help
4
by: aakriti | last post by:
how to make a digital clock from using code of java,
9
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the...
10
by: merooo0ooo | last post by:
HELLO how are u all ? i want to do digital clock applet may be it's very stubid qez but i'm still biggener in java and i want to any one learn me how i can used thread to do digital clock but...
6
Parul Bagadia
by: Parul Bagadia | last post by:
Hi all, I want to make a digital clock in ActiveX DLL... any components ofr that? As such in VB we have to use all in-built tools... How do we add an AcitveX DLL in other VB applications?.. I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.