Posted on 2007-01-14 23:31 
sugo 阅读(2105) 
评论(2)  编辑  收藏  
			 
			
		 
		    当提交表单时,此时操作人员只需等待结果返回,这里,我实现了一个覆盖网页的方法,使得整个网页被一个很大的div覆盖,这样操作人员就不能点击页面的内容了。实现很简单,一个div
    <div id="doing"  style="Z-INDEX: 12000; LEFT: 0px; WIDTH: 100%; CURSOR: wait; POSITION: absolute; TOP: 0px; HEIGHT: 100%; display:none "> 
            <table width="100%" height="100%"> 
                <tr align="center" valign="middle"> 
                    <td> 
                        <table width="169" height="62" bgcolor="#99cccc" style="FILTER: Alpha(Opacity=75); WIDTH: 169px; HEIGHT: 62px"> 
                            <tr align="center" valign="middle"> 
                                <td>页面提交中.<br> 
                                    Loading.</td> 
                            </tr> 
                        </table> 
                    </td> 
                </tr> 
            </table> 
        </div>
     页面最初载入时把它隐藏起来,当按下提交按钮时让它显示。结果返回后再次让它隐藏。jsp代码:
     <%
          String content=request.getParameter("tc");
          if(content==null){
    %>
        <form action="#" method="post" onsubmit="return show()">
          <textarea name="tc">dfdfsdf
             dfdaf</textarea>
          <input type=submit value=" go "  >
       </form>
   <%
     }
       else{
           if(content.indexOf("\n")==-1)
             out.println("haha");
            // content=content.replaceAll("\n","<br>");
   %>
          <textarea> <% out.println(content); %>
        </textarea>
   <%
      }
   %>
   show方法:
    function show(){
         document.getElementById('doing').style.display=''
         return true;
   }
    当表单提交并返回结果时,页面重新加载,div的display属性自动又变为none。达到了想要的效果。