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 need some help with is this one. I got it to validate. But something is wrong with the logic maybe. It bombs out on object expected .
Please give me some input. thanks
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Digital Clock</title>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
function curTime() {
var now = new date();
var day = now.GetDay();
var date = now.GetDate();
var year = now.GetFullYear();
var month = now.GetMonth();
var hours = now.GetHours() + 1;
var minutes = now.GetMinutes();
var seconds = now.GetSeconds();
var days = new Array();
days[0] = "Sunday"; days[1] = "Monday"; days[2] = "Tuesday";
days[3] = "Wednesday"; days[4] = "Thursday"; days[5] = "Friday";
days[6]="Saturday";
var display = days[day] + " " + month + "/" + date + "/"
+ year + " "+ hours + ":" + minutes + ":" + seconds;
document.forms[0].Readout.value = display;
}
var tick = setInterval("curTime()", 1000);
// STOP HIDING FROM INCOMPATIBLE BROWSERS --></script></head>
<body>
<form action="">
<p><input type="text" size="30" name="readout" /></p>
</form>
</body>
</html>
4 4994
I doubt this will solve the problem, but make sure the cases are matching. Your input name is "readout" but you're calling it as "Readout".
Furthermore, I believe you'll have to call the function when the page is loaded, ie body onLoad="CurDate()"... sorry I can't actually play around with it right now but I think that would be needed....
- <!-- Adjust the placement of the clock in the line below -->
-
<span id="pendule"></span>
-
<script language="javascript" type="text/javascript">
-
<!--
-
function clock() {
-
var digital = new Date();
-
var hours = digital.getHours();
-
var minutes = digital.getMinutes();
-
var seconds = digital.getSeconds();
-
var year = digital.getFullYear();
-
var day = digital.getDay();
-
-
var month = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec")
-
var day = new Array ("Sun","Mon","Tues","Wed","Thurs","Fri","Sat")
-
var amOrPm = "AM";
-
if (hours > 11) amOrPm = "PM";
-
if (hours > 12) hours = hours - 12;
-
if (hours == 0) hours = 12;
-
if (minutes <= 9) minutes = "0" + minutes;
-
if (seconds <= 9) seconds = "0" + seconds;
-
dispTime = day[digital.getDay()] + "." + " " + month[digital.getMonth()] + " " + digital.getDate() + "," + " " + year + " ";
-
dispTime = dispTime + hours + ":" + minutes + ":" + seconds + " " + amOrPm;
-
document.getElementById('pendule').innerHTML = dispTime;
-
setTimeout("clock()", 1000);
-
}
-
window.onload=clock;
-
// -->
-
</script>
Sorry missed the Edit timeout. This is one I've used for quite some time if need be I can make yours work, but nosense re-inventing the wheel.
HTH,
Aric
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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 ....:(
|
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...
|
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
|
by: aakriti |
last post by:
how to make a digital clock from using code of java,
|
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...
|
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...
|
by: ANB8503 |
last post by:
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!!
...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: 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...
| |