Ajax 和 Asp 的编程
时间:2020-12-05 11:58:54|栏目:JavaScript代码|点击: 次
ajax.html
<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="检测" onclick="javascript:f()"> <a href="javascript:f()">检测</a>
<div id=msg></div>
t.asp
<%
Response.ContentType="text/xml"
response.charset="gb2312"
if request.querystring("t1")="1" then
response.write("<OK/>")
else
response.write("<ERROR/>")
end if
%>
复制代码 代码如下:
<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="检测" onclick="javascript:f()"> <a href="javascript:f()">检测</a>
<div id=msg></div>
t.asp
复制代码 代码如下:
<%
Response.ContentType="text/xml"
response.charset="gb2312"
if request.querystring("t1")="1" then
response.write("<OK/>")
else
response.write("<ERROR/>")
end if
%>
上一篇:javascript 读取内联之外的样式(style、currentStyle、getComputedStyle区别介绍)
栏 目:JavaScript代码
本文标题:Ajax 和 Asp 的编程
本文地址:http://www.codeinn.net/misctech/29527.html