一个简单的ajax用户登陆返回值问题?有代码

来源:百度知道 编辑:UC知道 时间:2024/05/12 20:03:53
————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);
//

只想弹出值,就要过滤,如果匹配标签很多,可以写个过滤函数

单以你这段代码,好象就多个br,比如:

alert(xmlHttp.responseText.replace(/<br\/>/g, "\n"));