index.htm
-----------
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head><body>
<input type=button onclick="showServerTime()" value="serverTime"><script language="javascript">
<!--
function showServerTime()
{
var oHttp = new ActiveXObject("Microsoft.XMLHTTP");
oHttp.open("POST","Default.asp",false);
oHttp.send();
alert(oHttp.responseText);
}
//-->
</script>
</body></html>getTime.asp
------------------
<%
Response.write Now()
%>
-----------
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head><body>
<input type=button onclick="showServerTime()" value="serverTime"><script language="javascript">
<!--
function showServerTime()
{
var oHttp = new ActiveXObject("Microsoft.XMLHTTP");
oHttp.open("POST","Default.asp",false);
oHttp.send();
alert(oHttp.responseText);
}
//-->
</script>
</body></html>getTime.asp
------------------
<%
Response.write Now()
%>
服务器有数据库吧,如oracle,实现:rs=stmt.executeQuery("select to_char(sysdate,'yyyymmddHH24MISS");
string date=rs.getString(1);
<%=date%>
var a = new Date()
a = a.getFullYear() + "-" + (a.getMonth() +1) + "-"+a.getDate() + " "+a.getHours() + ":"+a.getMinutes()
Response.Write(a)
</script>