- 〈script lanuage = "javaScript"〉
- //建立對象
- function createXMLHttpRequest(){
- if(window.ActiveXObject){
- xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
- }
- else if(window.XMLHttpRequest){
- xmlHttp = new XMLHttpRequest();
- }
- }
- //前臺界面事件調用的函數
- function checkName(){
- createXMLHttpRequest();
- xmlHttp.onreadystatechange = handleStateChange;
- var sql = "UserReg.aspx?";
- xmlHttp.open("GET",sql,true);
- xmlHttp.send(null);
- }
- //和服務器交互期間執行的函數
- function handleStateChange(){
- if(xmlHttp.readyState == 4){
- if(xmlHttp.status == 200){
- document.getElementById("divx").innerHTML = xmlHttp.responseText;
- }
- }
- }
- 〈script〉