Ajax实现评论提交
2024-09-01 08:29:56
供稿:网友
代码如下:
document.write('<DIV id="loadingg" style="HEIGHT:65px; WIDTH: 205px;POSITION: absolute; Z-INDEX:1000;border:3px #fff solid;text-align:center; font-size:12px; font-family:Arial, Helvetica, sans-serif;color:#660000;background:#222;opacity:.7;-moz-opacity:.7;filter: alpha(opacity=70); display:none;"><br/><font color="#FF6600"><strong>数据正在读取中,请等候...</strong></font><br/><img src="images/loading.gif"/></DIV>')
function showloading()
{
var obj=document.getElementById("loadingg")
if (obj.style.display!="")
{
obj.style.left=((document.documentElement.clientWidth-parseFloat (obj.style.width))/2)+document.documentElement.scrollLeft+"px";
obj.style.top=((document.documentElement.clientHeight-parseFloat (obj.style.height))/2)+document.documentElement.scrollTop+"px";
obj.style.display="";
}else{obj.style.display="none";}
}
function $(id)
{ return document.getElementById(id); }
function echo(obj,html){ $(obj).innerHTML=html;}
function fopen(obj){$(obj).style.display="";}
function fclose(obj){$(obj).style.display="none";}
function createxmlhttp(){
var xmlhttp=false;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
if (xmlhttp.overrideMimeType) {//设置MiME类别
xmlhttp.overrideMimeType('text/xml');
}
}
return xmlhttp;
}
function getdata(url,obj1,obj2)
{ var xmlhttp=createxmlhttp();