您的位置:首页 > 其它

web页面中按钮执行处理时间过长,添加div等待层

2013-04-28 19:22 525 查看
web页面中按钮执行处理时间过长,添加div等待层,提升用户体验

javascript 文件:

var coverLayer = {

divObj : null,

_coverTime : null,

// _coverRe : function()

// {//刷新遮盖层

// this.divObj.style.width = window.screen.availWidth + "px";

// this.divObj.style.height = window.screen.availHeight + "px";

// },

on : function(noSave)

{ //打开遮盖层

if(this.divObj == null)

{

this.divObj = document.createElement("div");

this.divObj.style.zIndex = 10000;

this.divObj.style.left = '0px';;

this.divObj.style.top = '0px';;

this.divObj.style.position = "absolute";

this.divObj.style.backgroundColor = "#DDDDDD";

this.divObj.style.fontSize = "x-large";

this.divObj.style.textAlign ="center";

this.divObj.innerText="处理中……";

var tempFrame = document.createElement("iframe");

tempFrame.style.filter = "Alpha(Opacity=0)";

tempFrame.frameBorder=0;

tempFrame.scrolling="no";

tempFrame.style.width = "100%";

tempFrame.style.height = "100%";

this.divObj.appendChild(tempFrame);

this.divObj.style.filter = "Alpha(Opacity=80)";

document.body.appendChild(this.divObj);

};

this.divObj.style.width = document.documentElement.clientWidth + "px";

this.divObj.style.height = document.documentElement.clientHeight + "px";

this.divObj.style.paddingTop =document.documentElement.clientHeight / 2 + "px";

this.divObj.style.display = "block";

// clearInterval(this._coverTime);

//this._coverTime = setInterval("coverLayer._coverRe()",1);

},

off : function(noSave)

{ //关闭遮盖层

if(this.divObj){this.divObj.style.display = "none"};

//clearInterval(this._coverTime);

}

}

Page_Load初期处理中添加:

If Not IsPostBack Then

...

myBtn.OnClientClick = "coverLayer.on();"

myLinkButton.OnClientClick = "coverLayer.on();"

...

End IF
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐