作者uniquely (aileen)
看板Ajax
标题[问题]框架页执行ajax後发生问题
时间Wed Dec 31 01:06:19 2008
小妹在写ajax时发生了一些问题
画面只是一般的框架页
左边放连结,右边就放连结的网页
一开始都没有问题
但我的网页只要执行过ajax後
左边点选连结时不会在右边显示
而是会开新网页
ajax的部分程式如下
function getstudata()
{
if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
{
name = encodeURIComponent(document.getElementById("a_stu_no").value);
xmlHttp.open("GET", "studata.php?name=" + name, true);
xmlHttp.onreadystatechange = handleServerResponse;
xmlHttp.send(null);
}
}
function handleServerResponse()
{
if (xmlHttp.readyState == 4)
{
if (xmlHttp.status == 200)
{
xmlResponse = xmlHttp.responseXML;
xmlDocumentElement = xmlResponse.documentElement;
Message = xmlDocumentElement.firstChild.data;
}
else
{
alert("There was a problem accessing the server: " + xmlHttp.statusText);
}
}
}
请问一下是不是我有地方写错呢?
谢谢大家
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.171.118.204