前提:需要用户自行搜索wait.gif滚动条图片,并且需要引入JQuery.js。
1.编写JS方法ShowDIV
function ShowDIV(thisObjID) {
$("#BgDiv").css({ display: "block", height: $(document).height() });
var yscroll = document.documentElement.scrollTop;
$("#" + thisObjID ).css("top", "100px");
$("#" + thisObjID ).css("display", "block");
document.documentElement.scrollTop = 0;
}
2.在提交表单的js中调用DIV层
// 提交表单
function doSubmit(){
sendForm.action = "<%=request.getContextPath()%>/gotoSwdxfsjsqk.do?method=swdxfsjsqk";
sendForm.submit();
ShowDIV('DialogDiv');
}
3.将如下语句块放到</script>后
<style>
#BgDiv{background-color:#e3e3e3; position:absolute; z-index:99; left:0; top:0; display:none; width:100%; height:1000px;opacity:0.5;filter: alpha(opacity=50);-moz-opacity: 0.5;}
#DialogDiv{position:absolute; left:50%; top:50%; margin-left:-200px;margin-top:10%; height:auto; z-index:100;}
</style>
4.将如下语句放到</form>前
<div id="BgDiv"></div>
<!--遮罩层显示的DIV1-->
<div id="DialogDiv" style="display:none">
<img src="<%=request.getContextPath()%>/pic/wait.gif" />
</div>