473,386 Members | 1,832 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,386 software developers and data experts.

Trouble with Digital Clock showing in Form Text box.

Hello, I have created the below script; however, it's not showing in the box like it should... Help please!! I am running out of time to submit this assignment!

Thanks in advance!!



Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. /* <! [CDATA[ */
  3.  
  4. function display() {
  5.     var Today = new Date();
  6.     var hours = Today.getHours();
  7.     var min = Today.getMinutes();
  8.     var sec = Today.getSeconds();
  9.     var Time = ((hours > 12) ? hours - 12 :(hours == 0) ? 12 :hours);
  10.     Time += ((min < 10) ? ":0" : ":") + min;
  11.     Time += ((sec < 10) ? ":0" : ":") + sec;
  12.     Time += (hours >= 12) ? " PM" : " AM";
  13.     this.clockForm.clock.value = Time;
  14.     setInterval("display()",1000);
  15.     } 
  16.  
  17.     display(); 
  18.  
  19.  
  20. /* ]]> */
  21. </script>
  22.  
  23. <body>
  24.  
  25. <h1>What time is it?</h1>
  26.  
  27. <form name = "clockForm">
  28.   <input type="text" name="clock" />
  29. </form>
  30.  
  31. </body>
  32.  
Oct 16 '09 #1
1 3513
Dormilich
8,658 Expert Mod 8TB
a) there’s no content to apply the result to (not yet loaded)
b) line 13/17: this refers to window …
Oct 16 '09 #2

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

Similar topics

1
by: Agency | last post by:
I'm still working on the bpm counter. I need to have at least 2 displays that are not static. One would be a clock/running time and the other would should the current beat count. How would I...
1
by: Weston C | last post by:
In the course of trying to build a simple clock, I've run into a problem using the setInterval (and setTimeout) function. http://weston.canncentral.org/misc/tkeep/tkeep.html...
1
by: Bill Strass | last post by:
I have a form showing the records of different people. I would like a photo to be displayed in the form, with each person's record. My digital photo > *.jpg type file and I change each photo...
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...
3
by: Avi G | last post by:
Hi, i work with VS 2005 and i need to know how to put the windows time(Clock) on my label that it is on the form that i will see the full time include the second as they move, and i need to know...
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: 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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.