比如弹出一个页面(类似alert,但没有确定按钮),显示“正在保存数据,请稍等!”。这个时候用户不能操作页面,直到保存数据完毕后才允许用户操作。

解决方案 »

  1.   

    <style type="text/css">
    <!--
    html,body {height:100%; margin:0px; font-size:12px;}.mydiv {
    background-color: #f9fff6;
    border: 1px solid #009900;
    text-align: center;
    line-height: 25px;
    font-size: 13px;
    font-weight: bold;
    z-index:99;
    width: 300px;
    height: 50px;
    left:50%;/*FF IE7*/
    top:50%;/*FF IE7*/margin-left:-150px!important;/*FF IE7 half of its width */
    margin-top:-60px!important;/*FF IE7 half of its height*/margin-top:0px;position:fixed!important;/*FF IE7*/
    position:absolute;/*IE6*/_top:       expression(eval(document.compatMode &&
                document.compatMode=='CSS1Compat') ?
                documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/
                document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2);/*IE5 IE5.5*/}
    .bg {
    background-color: #C2BEBF;
    width: 100%;
    height: 100%;
    left:0;
    top:0;/*FF IE7*/
    filter:alpha(opacity=40);/*IE*/
    opacity:0.4;/*FF*/
    z-index:1;position:fixed!important;/*FF IE7*/
    position:absolute;/*IE6*/_top:       expression(eval(document.compatMode &&
                document.compatMode=='CSS1Compat') ?
                documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/
                document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2);/*IE5 IE5.5*/} 
    --> 
    </style>
    <script language="javascript" type="text/javascript">
    function showDiv(){
    if(document.all){
        document.getElementById('bg').innerHTML = "<iframe style='width:100%;height:100%;left:0px;top:0px;position:absolute;filter:alpha(opacity=0);z-index:-1;border:0px'/>";
    }
    document.getElementById('popDiv').style.display='block';
    document.getElementById('bg').style.display='block';
    }function closeDiv(){
    document.getElementById('popDiv').style.display='none';
    document.getElementById('bg').style.display='none';
    }</script>
    <div id="popDiv" class="mydiv" style="display:none;">正在保存,请稍等..<br/>
    <!--<a href="javascript:closeDiv()">close</a>--></div>
    <div id="bg" class="bg" style="display:none;"></div><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title></title></head><body><input type="button" value="保存" onclick="showDiv()" /></body>
    </html>
      

  2.   

    有个地方没看明白,_top是什么意思?
      

  3.   

    没有提交页面。用AJAX保存可以提交到另一个页面就不行了!
      

  4.   

    请问二楼
    if(document.all)是什么意思?document.all代表什么?
      

  5.   

    document.all 是IE专有属性其实就是个浏览器判断,if(document.all) 为真就是IE,否则就是FF或者其他