开发的系统需要做到良好的客户体验,点击之后又一个等待的图片显示,利用XmlHttp可以实现。
主要js代码如下:
var result;
var content = "<table height=100% width=100%><tr><td><div id='divDoing' style='position:absolute; left:"+(screen.availWidth-500)/2+"px; top:136px; width:196px; height:105px; z-index:1;'><div align='center'><p><img src='../Images/doing.gif' width='32' height='32'/></p><p><br/>正在发送邮件,请稍候……</p></div></div></td></tr></table>";
contentTD.innerHTML = content;
var XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
XmlHttp.onreadystatechange=function(){
if(XmlHttp.readyState==4){
if(XmlHttp.status==200)
{
result = XmlHttp.responseText;
//alert(result);
if(result=="OK")
{
alert("邮件已经提交邮件服务器!");
location.href ="../Library/webinitPage.tkx?Source=SendResult";
}
else
{
alert("有错误发生,请重新发送。若还发送不成功请联系管理员!");
location.href ="../Library/webinitPage.tkx?Source=MailSend";
}
}
}
else
contentTD.innerHTML = content ;
}
}
XmlHttp.open("post","webinitPage.tkx?Source=MailSend",true);
XmlHttp.send(xml);
主要js代码如下:
var result;
var content = "<table height=100% width=100%><tr><td><div id='divDoing' style='position:absolute; left:"+(screen.availWidth-500)/2+"px; top:136px; width:196px; height:105px; z-index:1;'><div align='center'><p><img src='../Images/doing.gif' width='32' height='32'/></p><p><br/>正在发送邮件,请稍候……</p></div></div></td></tr></table>";
contentTD.innerHTML = content;
var XmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
XmlHttp.onreadystatechange=function(){
if(XmlHttp.readyState==4){
if(XmlHttp.status==200)
{
result = XmlHttp.responseText;
//alert(result);
if(result=="OK")
{
alert("邮件已经提交邮件服务器!");
location.href ="../Library/webinitPage.tkx?Source=SendResult";
}
else
{
alert("有错误发生,请重新发送。若还发送不成功请联系管理员!");
location.href ="../Library/webinitPage.tkx?Source=MailSend";
}
}
}
else
contentTD.innerHTML = content ;
}
}
XmlHttp.open("post","webinitPage.tkx?Source=MailSend",true);
XmlHttp.send(xml);
XmlHttp.onreadystatechange
浙公网安备 33010602011771号