用ajax,服务端用什么语言都可以。
servertime.htm文件
<input type="text" name="UserID" style="border:none">
<SCRIPT LANGUAGE="JavaScript">
function validateuserid()
{
document.body.style.cursor='wait';
if (window.XMLHttpRequest)
oXMLHTTP = new XMLHttpRequest();
else if (window.ActiveXObject)
oXMLHTTP = new ActiveXObject("Msxml2.XMLHTTP");var sURL = "http://localhost:8080/ServerTime.php"
oXMLHTTP.open("GET", sURL, false);
oXMLHTTP.send(); // 根据返回的结果来显示服务器时间
if (oXMLHTTP.responseText != "")
UserID.value = oXMLHTTP.responseText;
document.body.style.cursor='auto';
window.setTimeout("validateuserid()",100);
}
validateuserid();
</SCRIPT> servertime.php文件
<?
echo date("Y-m-d h:i:s");
?>=================================================================
运行servertime.htm就可以了,var sURL = "http://localhost:8080/ServerTime.php" 地址自己改改就行了。
servertime.htm文件
<input type="text" name="UserID" style="border:none">
<SCRIPT LANGUAGE="JavaScript">
function validateuserid()
{
document.body.style.cursor='wait';
if (window.XMLHttpRequest)
oXMLHTTP = new XMLHttpRequest();
else if (window.ActiveXObject)
oXMLHTTP = new ActiveXObject("Msxml2.XMLHTTP");var sURL = "http://localhost:8080/ServerTime.php"
oXMLHTTP.open("GET", sURL, false);
oXMLHTTP.send(); // 根据返回的结果来显示服务器时间
if (oXMLHTTP.responseText != "")
UserID.value = oXMLHTTP.responseText;
document.body.style.cursor='auto';
window.setTimeout("validateuserid()",100);
}
validateuserid();
</SCRIPT> servertime.php文件
<?
echo date("Y-m-d h:i:s");
?>=================================================================
运行servertime.htm就可以了,var sURL = "http://localhost:8080/ServerTime.php" 地址自己改改就行了。
除非你是ASP,PHP,JSP,CGI,ASP。NET等其中的一种。
你说的是PHP技术+AJAX。
-------------个性签名---------------
http://www.esoftnow.com/bbs
欢迎光临·可以灌水,不许沉默。
servertime.php文件
<?
echo date("Y-m-d h:i:s");
?>