首页 > 代码库 > 等待层
等待层
/** * 等待层 */ setWaitPanel:function(){ if(document.getElementById("loader_container")!=null){ return; } var sWidth = document.body.offsetWidth; var sHeight = document.body.scrollHeight; panel = document.createElement("div"); panel.setAttribute(‘id‘, ‘bgDiv‘); panel.setAttribute(‘class‘, ‘msgCover‘); panel.style.width = sWidth + "px"; panel.style.height = sHeight + "px"; document.body.appendChild(panel); obj1 = document.createElement("div"); obj1.setAttribute("id","loader_container"); var obj2 = document.createElement("div"); obj2.setAttribute("id", "loader"); document.body.appendChild(obj1); document.getElementById("loader_container").appendChild(obj2); var obj3 = document.createElement("div"); obj3.setAttribute("id","load_img"); document.getElementById("loader").appendChild(obj3); var obj4 = document.createElement("div"); obj4.setAttribute("id","load_msg"); obj4.innerHTML = "载入中..."; document.getElementById("loader").appendChild(obj4); }, /** * 清除等待层 */ clearWaitPanel:function(){ document.body.removeChild(panel); document.body.removeChild(obj1); } };=================================提交时设置等待层,显示数据后清除等待层.msgCover { background: none repeat scroll 0 0 #777; opacity: 0.65; position: absolute; top: 0; left: 0; z-index: 10000;}#loader_container { text-align: center; position: absolute; top: 200px; width: 100%; left: 0; z-index: 10001;}#loader { font-size: 11.5px; background-color: #FFFFFF; padding: 10px 0; margin: 0 auto; height: 18px; width: 120px; border: 1px solid #5a667b; z-index: 2; -moz-border-radius: 5px; -webkit-border-radius: 5px;}#load_img { background-image: url("../images/wait.gif"); background-size: 16px 16px; background-repeat: no-repeat; float: left; height: 22px; margin: 2px 0 0 10px; width: 23px;}#load_msg { float: left; margin: 3px 0;}============用法=============提交后设置等待层 SA.setWaitPanel();数据响应返回后清除等待层 SA.clearWaitPanel();
等待层
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。