function closeloading()
{
    var loaddiv; 
    var bgdiv;
    showAllSelect();
    bgdiv=document.getElementById("bgdiv");
    loaddiv=document.getElementById("loaddiv");
    if(bgdiv)
    {
        document.body.removeChild(bgdiv);
    }
    if(loaddiv){     
        document.body.removeChild(loaddiv);
    }
    document.body.style.cursor="default";
}
function showloading(){
    hideAllSelect();
    var loaddiv;   
    if(loaddiv=document.getElementById("loaddiv")){   
        loaddiv.style.display = "block";   
    }else{   
        loaddiv = document.createElement("div");   
        loaddiv.id="loaddiv";   
        loaddiv.style.position = "absolute";   
        loaddiv.style.zIndex = 1000;   
        loaddiv.style.display="block";   
        loaddiv.style.left = 0;   
        loaddiv.style.top  = 0;   
        loaddiv.style.border = "1px solid gray"  
        loaddiv.style.background = "#ffffff"  
        loaddiv.style.padding = "5";   
    }   
       
    var scrollTop=0;   
    var clientHig=0;
    if(top.document.documentElement && top.document.documentElement.scrollTop){   
        scrollTop = top.document.documentElement.scrollTop;
    }else if(document.body){   
        scrollTop = top.document.body.scrollTop;  
    }   
   
    clientHig=document.body.clientHeight;
       
    var scrollWid = document.body.scrollWidth/2-150;
    loaddiv.style.left = scrollWid+"px";   
    loaddiv.style.top  = (scrollTop+clientHig/2)+"px";
       
    loaddiv.innerHTML = "<img src='../images/loading02.gif'><h>&nbsp;&nbsp;数据正在获取,请稍等。。。</h>";  
    document.body.style.cursor="wait";     
       
       
  var sWidth,sHeight;   
  sWidth=document.body.scrollWidth;//浏览器工作区域内页面宽度 或使用 screen.width//屏幕的宽度   
  sHeight=document.body.scrollHeight;//屏幕高度(垂直分辨率)   
  
  
  //背景层(大小与窗口有效区域相同,即当弹出对话框时,背景显示为放射状透明灰色)   
  var bgObj=document.createElement("div");//创建一个div对象(背景层) //动态创建元素,这里创建的是 div   
  //定义div属性,即相当于(相当于,但确不是,必须对对象属性进行定义   
  //<div id="bgDiv" style="position:absolute; top:0; background-color:#777; filter:progid:DXImagesTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75); opacity:0.6; left:0; width:918px; height:768px; z-index:10000;"></div>   
  bgObj.setAttribute('id','bgdiv');   
  bgObj.style.position="absolute";   
  bgObj.style.top="0";   
  bgObj.style.background="#ffffff";   
  bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75";   
  bgObj.style.opacity="0.6";   
  bgObj.style.left="0";   
  bgObj.style.width=sWidth + "px";   
  bgObj.style.height=sHeight + "px";   
  bgObj.style.zIndex = "10000";   
  //bgObj.innerHTML="<iframe src='javascript:false' style='position:absolute; visibility:inherit; top:0px; left:0px; width:100px; height:200px; z-index:-1;' ></iframe>";
  //bgObj.innerHTML+="filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)'";
  //bgObj.innerHTML+="></iframe>";
  document.body.appendChild(bgObj);//在body内添加该div对象   
       
  document.body.appendChild(loaddiv);   
 
}

function hideAllSelect()
{
    objs=document.getElementsByTagName("select");
    for(i=0;i<objs.length;i++)
    {
        objs[i].style.display="none";
    }

function showAllSelect()
{
    objs=document.getElementsByTagName("select");
    for(i=0;i<objs.length;i++)
    {
        objs[i].style.display="";
    }
}

posted on 2010-05-23 16:25  十分之七  阅读(1448)  评论(1编辑  收藏  举报