帮忙看看什么地方出错了,该如何修改
<script language="javascript" type="text/javascript">
function createHttpRequest() {
if(window.ActiveXObject){
return new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
return new XMLHttpRequest();
}
}
var xmlhttp;
function userExists(loginID) {
if(loginID!=null){
var url = "Degault.aspx?loginid="+loginID;
xmlhttp = createHttpRequest();
xmlhttp.onreadystatechange = readyDo;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
}
function readyDo() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
var result = xml.responseText;
if (returns == "true") {
document.getElementById("div2").s.display = "block";
}
else {
document.getElementById("div2").s.display = "none";
}
}
}
</script>
//跳转页面代码
protected void Page_Load(object sender, EventArgs e)
{
string name = Request.QueryString["loginid"].ToString();
if (name == "accp")
{
Response.Write("用户名已存在");
}
else
{
Response.Write("该用户可以使用");
}
}
跳转页面不知道该如何写
------解决方案--------------------if (returns == "true") {
document.getElementById("div2").s.display = "block";
}
else {
document.getElementById("div2").s.display = "none";
}
你这个returns是什么?
------解决方案-------------------- 问题显而易见,后台Response.Write没有结束,因此前台会获取到整个html页面
修改下:
//跳转页面代码
protected void Page_Load(object sender, EventArgs e)
{
string name = Request.QueryString["loginid"].ToString();
if (name == "accp")
{
Response.Write("用户名已存在");
}
else
{
Response.Write("该用户可以使用");
}
Reponse.End();
}