一个简单的ajax用户登陆返回值问题?有代码
————aaa.asp文件————————————<htmlxmlns="http://www.w3.org/1999/xhtml"><head><title>Using...
————aaa.asp 文件————————————
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using responseText with innerHTML</title>
<meta charset="gb2313">
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest() {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
//xmlHttp.open("post", "bb.html", true);
xmlHttp.open("POST", 'bbb.asp?name='+document.getElementById("name").value + "&pwd=" + document.getElementById("pwd").value, true);
//xmlHttp.open("POST", "bbb.asp", true);
xmlHttp.send(null);
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
document.getElementById("results").innerHTML = xmlHttp.responseText;
}
}
}
</script>
</head>
<body>
<p>姓名:<input type="text" name="name" size="20"></p>
<p>密码:<input type="password" name="pwd" size="20"></p>
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="button" value="确定" name="B3" onclick="startRequest();"></p>
<div id="results"></div>
</body>
</html>
-----bbb.asp------
<%
name = request("name")
pwd = request("pwd")
response.write "your name is " & name
response.write "<br/>your password is " & pwd
%>
我现在要用alert()弹出返回回来的值 ,我是这么写的
把document.getElementById("results").innerHTML = xmlHttp.responseText;
换成了
alert( xmlHttp.responseText);
可是弹出来的有很多的标签信息
我只想要弹出值 ,请问该怎么作,谢谢 展开
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Using responseText with innerHTML</title>
<meta charset="gb2313">
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function startRequest() {
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
//xmlHttp.open("post", "bb.html", true);
xmlHttp.open("POST", 'bbb.asp?name='+document.getElementById("name").value + "&pwd=" + document.getElementById("pwd").value, true);
//xmlHttp.open("POST", "bbb.asp", true);
xmlHttp.send(null);
}
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
document.getElementById("results").innerHTML = xmlHttp.responseText;
}
}
}
</script>
</head>
<body>
<p>姓名:<input type="text" name="name" size="20"></p>
<p>密码:<input type="password" name="pwd" size="20"></p>
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><input type="button" value="确定" name="B3" onclick="startRequest();"></p>
<div id="results"></div>
</body>
</html>
-----bbb.asp------
<%
name = request("name")
pwd = request("pwd")
response.write "your name is " & name
response.write "<br/>your password is " & pwd
%>
我现在要用alert()弹出返回回来的值 ,我是这么写的
把document.getElementById("results").innerHTML = xmlHttp.responseText;
换成了
alert( xmlHttp.responseText);
可是弹出来的有很多的标签信息
我只想要弹出值 ,请问该怎么作,谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询