Hi
THANKS! for the help, it works great.
I've copied my version below incase anyone is interested.
Al
*************** ******
<%@ language="VBScr ipt" %>
<% Option Explicit %>
<%
' VBscript!!!
DIM GMT
GMT = year(now) & ", "&month(Now )-1&", "&day(now)& ",
"&hour(now) &", "&Minute(Now)&" , " & second(now)
%>
<head>
<script language="JavaS cript1.2" type="text/javascript">
<!-- Begin
function UserTime()
{
mDateTime1 = Date().split(" ");
var clockHandle = true; // Dummy init value
clockHandle = GetElement('MyD ateTime');
if (clockHandle) {
clockHandle.inn erHTML = mDateTime1[1] + " " +
mDateTime1[2] + ", " + mDateTime1[4] + ", " + mDateTime1[3];
}
setTimeout("Use rTime()", 500);
}
var t=+ new Date(<%=GMT %>)
function ServerTime() {
mServerDT = new Date(t)
monthNames = new Array("", "Jan", "Feb", "Mar", "April",
"May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec")
Hour = mServerDT.getHo urs()
Minutes = mServerDT.getMi nutes()
Seconds = mServerDT.getSe conds()
Day = mServerDT.getDa te()
Hour < 10 ? Hour = "0" + Hour.toString() :
Hour=Hour.toStr ing()
Minutes < 10 ? Minutes = "0" + Minutes.toStrin g() :
Minutes=Minutes .toString()
Seconds < 10 ? Seconds = "0" + Seconds.toStrin g() :
Seconds=Seconds .toString()
Day < 10 ? Day = "0" + Day.toString() : Day=Day.toStrin g()
var clockHandle = true; // Dummy init value
clockHandle = GetElement('Ser verDateTime');
if (clockHandle) {
clockHandle.inn erHTML = Hour + ":" + Minutes + ":" +
Seconds + " " + monthNames[mServerDT.getMo nth()+1] + " " + Day + ", "
+ (mServerDT.getF ullYear()+21)
}
t +=500
setTimeout('Ser verTime()', 500)
}
// End -->
</script>
</head>
=============== ============
GetElement.js included as well:
var DOM = (document.getEl ementById ? 1 : 0);
var IE4DOM = (document.all ? 1 : 0);
function GetElement(id) {
var idHandle = (DOM ? document.getEle mentById(id) : (IE4DOM ?
document.all[id] : false));
return (idHandle ? idHandle : false);
}
On 20 Dec 2003 08:18:49 GMT, "Evertjan."
<ex************ **@interxnl.net > wrote:
Harag wrote on 20 dec 2003 in microsoft.publi c.inetserver.as p.general: I think this is in the wrong group but since I don't read others much
or code in java script I was wondering if anyone could help me with
this small problem, as I code mostly in ASP vbscript.
I have the following piece of Javascript client code that displays the
users clock on the browser and updates it every second.
Only coded for IE:
======== times.asp =======
Client timezone corrected server date/time:
<div id=a>Please wait</div>
Client date/time:
<div id=b>Please wait</div>
<script runat=server language=jscrip t>
gmt=+new Date()
</script>
<script>
var t=+<%=gmt%>
var tOut
function eachSecond(){
tOut=setTimeout ('eachSecond()' ,1000)
a.innerHTML=new Date(t)
b.innerHTML=new Date()
t+=1000
}
eachSecond()
</script>
============== ==