//-------------------Ajax begin--------------------------
var xmlHttp;
function createXMLHttpRequest() {
//表示當前瀏覽器不是ie,如ns,firefox
if(window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
function validate() {
createXMLHttpRequest();
var clientId = document.getElementById("clientId").value;
var url = "../servlet/ClientIdValidateServlet?clientId=" + clientId + "×tampt=" + new Date().getTime();
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange=callback;
xmlHttp.send(null);
}
function callback() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
var resTextSpan = document.getElementById("resText");
resTextSpan.innerHTML = "<font color='red'>" + xmlHttp.responseText + "</font>";
}
}
}
//-------------------Ajax end--------------------------