Refresh Time

I’m making a web page and I want to show the time on the top of it just for looks. So I made a time/date field, in the default value I have @now which works great it show me the time the web page is open or if I hit the refresh button it updates the time, but I want to show the current time. Does anyone know how I can refresh this field every second so it show the current time?

Subject: Refresh Time

Adam,

    I used a DIV tag in the form and a javascript function to write the current time to the div tag in a loop (1000 milliseconds). Call this function onload of the form. Its little tricky but will solve yr problem.

Rajesh

Subject: RE: Refresh Time

Can you give me more detail on how to do this I do not unstand what you told me to do

Subject: RE: Refresh Time

  1. In the form create a DIV tag using Pass Thru HTML. 2. In the JSHeader write a javascript function which prints the current time into the DIV tag. You can use DHTML to print the time in the DIV tag

(like “doc.all.divtag.innerhtml=currenttime”).

  1. On Onload of the form call this javascript function in a loop. (every 1000 millisecond)

Hope it helps.

Subject: RE: Refresh Time

sorry I am new to Designer and still do not understand how do I make a DIV tag? Then how do I do the onload of the form cal the javascript? Thanks for you help

Subject: RE: Refresh Time

What he’s trying to say is that you need to create some pass-through HTML on your form where you want the time to show.

or

The current date & time is .

You then need a Javascript function to update the contents of that div on a periodic basis (every 1000 miliseconds).

Create this function in the JS Header section.

function showTime(){

document.getElementById(“clock”).innerHTML = Date();

}

In the onLoad event of the page/form, enter this:

window.setInterval(“showTime()”, 1000);

That’s basically it. You’ll want to tweak that so that it shows only the time or change the format of the Date() output.

Note this is using the local computer’s clock, not the one on the server.

For more on using the Date() object check out:

Subject: RE: Refresh Time

Thanks that helped a lot I got it figered out.