Now, I hope you got the explanation by OriginalGriff.
Here comes my answer:
You don't have to do it in JavaScript. Just add to your header:
<html>
<head>
<title>...</title>
<meta http-equiv="refresh" content="0.7">
</head>
<body>
<!- ... ->
</body>
</html>
Can you understand what difference does it make? If not, look for
http-equiv
and "
refresh
".
That was about your solution based on the HTTP response provided by the server side. You can do it purely on the client side, like OriginalGriff advised. It can look like this:
<html>
<head>
<title>...</title>
<meta http-equiv="refresh" content="0.7">
</head>
<body>
<p id="clock">Clock goes here</p>
<script type="text/javascript"></script>
</body>
</html>
Can you understand how it works?
[EDIT]
The solution based on full refresh and "
http-equiv
" is in fact pretty bad. I've shown it just to give an illustration on how Web works, and what server side does in your case, as a hint. A real solution should be based on JavaScript timer. There are many places where you can find it; here is just one:
http://stackoverflow.com/questions/9247977/clock-in-javascript[
^].
—SA