asp无刷新签到
怎么实现这类签到功能,要求无刷新签到。
------解决方案--------------------
参考:
用ajax技术实现
代码: t.htm
<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()">
<div id=msg></div>
代码:
t.asp
<%
Response.ContentType="text/xml"
if request.querystring("t1")="1" then
response.write("<OK/>")
else
response.write("<ERROR/>")
end if
%>
传统的asp无刷新技术
代码t.htm
<script>
function f(){
document.getElementById("o").src="t.asp t1="+t1.value
}
</script>
<div>1:显示"OK"; 其他字符:显示"Error"</div>
<input id=t1 name=1 value=1>
<input type=button value="检测" onclick="javascript:f()">
<div id=msg></div>
<iframe src="t.asp" style="display:none" id=o></iframe>
代码t.asp
<%
if request.querystring="" then response.end
ss="ERROR"
if request.querystring("t1")="1" then ss="OK"
%>
<script>parent.msg.innerText="<%=ss%>"</script>