function GetInfo(){//我们就是通过这个函数来异步获取信息的
var xmlHttpReq = null;//声明一个空对象用来装入XMLHttpRequest
var oldpw = document.getElementById("oldPassword").value;
var newpw =document.getElementById("newPassword").value;
var againpw = document.getElementById("againPassword").value;
if(newpw==againpw){
if (window.XMLHttpRequest){//除IE5 IE6 以外的浏览器XMLHttpRequest是window的子对象
xmlHttpReq = new XMLHttpRequest();//我们通常采用这种方式实例化一个XMLHttpRequest
}
else if (window.ActiveXObject){//IE5 IE6是以ActiveXObject的方式引入XMLHttpRequest的
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
//IE5 IE6是通过这种方式
}
if(xmlHttpReq != null){//如果对象实例化成功 我们就可以干活啦
xmlHttpReq.open("post","PassWordSetting.aspx?password="+oldpw+"&newpassword="+newpw,true);
//调用open()方法并采用异步方式
xmlHttpReq.onreadystatechange=RequestCallBack; //设置回调函数
xmlHttpReq.send(null);//因为使用get方式提交,所以可以使用null参调用
}
function RequestCallBack(){//一旦readyState值改变,将会调用这个函数
if(xmlHttpReq.readyState == 4)
{
if(xmlHttpReq.responseText == "true")
{
alert("密码修改成功!");
}
else
{
alert("原密码错误!");
}
}
}
}
else
{
alert("两次密码输入不相同!");
}
}
在主页中嵌套的iframe网页中使用上面的代码,然后出现
ReferenceError: RequestCallBack is not defined
[在此错误处中断] xmlHttpReq.onreadystatechange=RequestCallBack; //设置回调函数
var xmlHttpReq = null;//声明一个空对象用来装入XMLHttpRequest
var oldpw = document.getElementById("oldPassword").value;
var newpw =document.getElementById("newPassword").value;
var againpw = document.getElementById("againPassword").value;
if(newpw==againpw){
if (window.XMLHttpRequest){//除IE5 IE6 以外的浏览器XMLHttpRequest是window的子对象
xmlHttpReq = new XMLHttpRequest();//我们通常采用这种方式实例化一个XMLHttpRequest
}
else if (window.ActiveXObject){//IE5 IE6是以ActiveXObject的方式引入XMLHttpRequest的
xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
//IE5 IE6是通过这种方式
}
if(xmlHttpReq != null){//如果对象实例化成功 我们就可以干活啦
xmlHttpReq.open("post","PassWordSetting.aspx?password="+oldpw+"&newpassword="+newpw,true);
//调用open()方法并采用异步方式
xmlHttpReq.onreadystatechange=RequestCallBack; //设置回调函数
xmlHttpReq.send(null);//因为使用get方式提交,所以可以使用null参调用
}
function RequestCallBack(){//一旦readyState值改变,将会调用这个函数
if(xmlHttpReq.readyState == 4)
{
if(xmlHttpReq.responseText == "true")
{
alert("密码修改成功!");
}
else
{
alert("原密码错误!");
}
}
}
}
else
{
alert("两次密码输入不相同!");
}
}
在主页中嵌套的iframe网页中使用上面的代码,然后出现
ReferenceError: RequestCallBack is not defined
[在此错误处中断] xmlHttpReq.onreadystatechange=RequestCallBack; //设置回调函数
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货