代码如下:
function LoadAjaxIco(text)
{
try{
if(text == null || text =="")
text = "正在加载";
var element = document.createElement("span");
var img = document.createElement("img");
var spn = document.createElement("span");
spn.innerHTML = " " + text + "...";
spn.style.color="#000000";
img.setAttribute("src","/images/loading.gif");
img.setAttribute("align","absmiddle");
img.setAttribute("border","0px");
element.setAttribute("id","AjaxIcoDiv");
element.style.posITion = "absolute";
element.style.textAlign = "center";
element.style.padding = "4px 4px 4px 4px";
element.style.top = document.body.scrollTop + "px"; //此处直接删掉了页面的<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 还需要处理
element.style.width = "100";
element.style.height = "20px";
element.style.backgroundColor= "#ffffff"; //www.jb200.com
element.style.left = (document.body.scrollWidth - 105) + "px";//这里还需处理.
element.appendChild(img);
element.appendChild(spn);
document.body.appendChild(element);
}
catch(e){}
}
//卸载AJAX提示
function UnLoadAjaxIco()
{
try{
document.body.removeChild(document.getElementById("AjaxIcoDiv"));
}
catch(e){}
} //IE和FF下测试通过