页面提交的内容太多,后台处理太慢,这个时候,我们需要用一个遮罩效果来防止用户点击多次提交的按钮,废话不多说,代码如下:
在html页面放置下面的代码:
<div id="btnForm" style="position:fixed !important;position:absolute;top:0;left:0;height:100%; width:100%; z-index:999;background:#999 url(/images/load.gif) no-repeat center center;display:none;
opacity:0.6; filter:alpha(opacity=60);font-size:14px;line-height:20px;">正在保存,请稍后......
</div>
背景图片可以去网上找一个动态的 http://interjc.googlecode.com/svn/trunk/waterfall/img/load.gif
<script type="text/javascript">
function submitButton(){
//显示遮罩效果
$("#btnForm").show();
//进行提交前的操作
ajax提交.....
操作完毕后
$("#btnForm").hide();
}
</script>