DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> JavaScript入門知識 >> AJAX入門 >> AJAX詳解 >> Ajax 和 Asp 的編程
Ajax 和 Asp 的編程
編輯:AJAX詳解     

AJax.Html
[復制此代碼]CODE:
<script>
function f(){
var req =new ActiveXObject("Microsoft.XMLHTTP"); 
req.open("GET","t.ASP?t1="+t1.value, true); 
req.onreadystatechange = function(){
  if (req.readyState == 4) { 
  if (req.status == 200) { 
   msg.innerText = req.responseXML.documentElement.tagName; 
}
}
}
req.send(null); 

</script>
<div>1:顯示"OK"; 其他字符:顯示"Error"</div>
<input id=t1 value=1>
<input type=button value="檢測" > <a href="Javascript:f()">檢測</a>
<div id=msg></div>

t.ASP
[復制此代碼]CODE:
<% 
Response.ContentType="text/XML"
response.charset="gb2312"
if request.querystring("t1")="1" then
response.write("<OK/>")
else
response.write("<ERROR/>")
end if 
%>

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved