DanUK
08-02-2003, 11:44 AM
Hello.
I have the following script:
<SCRIPT>
document.write(Date()+".") </SCRIPT>
Is there anyway to make this script work as if it's a proper clock, i.e. to make the seconds go up and suchlike?
Thanks.
AdamGundry
08-02-2003, 11:47 AM
You could try this script (http://www.agbs.co.uk/scripts/clock.html).
Adam
jakykong
08-02-2003, 05:39 PM
well, i'd start by thining logic. You need to keep checking it, and updating the field. Make a clock function, like this one:
|function clock()
|.{
|..document.write(date()+".")
|..clock()
|.}
|clock()
if you call the function from within the function, it will never end. he downside, after this section is executed, nothing else will be run, so i'd make a text field, and update the value constantly, and don't execute that line of code until everything else is loaded.
|<html>
|.<head>
|..<script>
|..function clock()
|...{
|....document.formname.fieldname.value = date()+"."
|....clock()
|...}
|..</script>
|.</head>
|.<body onload="clock()">
|...<form name=formname>
|...<input type=text name=fieldname>
|..</form>
|.</body>
|</html>
that would be what i would do(and i once did, but decided i didn't want a clock!)