div 覆盖asp.net页面

表单提交时的页面覆盖
当提交表单时,此时操作人员只需等待结果返回,这里,我实现了一个覆盖网页的方法,使得整个网页被一个很大的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" οnsubmit="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。达到了想要的效果。
div 覆盖asp.net页面

<script language="javascript">
    function fGoto()
    {
     var w = window.screen.availWidth -100 ;

     var h = self.screen.availHeight -200;  

     var doc=window.document;

     var div=doc.createElement("DIV");

     var info="<table border=1 STYLE=width:"+ w +";height:"+ h +";background-color:red;filter:alpha(opacity=30)><tr><td align=/"center/"><input type=button value=返回 οnclick=javascript:document.getElementsByTagName('BODY')[0].removeChild(showerr);></td></tr></table>"

     div.id='showerr';

     div.style.position='absolute';

     div.style.z_index=100;

     div.style.width=900;

     div.style.left=0;

     div.style.top=0;

     div.innerHTML=info;

     doc.getElementsByTagName("BODY")[0].appendChild(div);

    }
</script>
<html>
<body>
<img οnclick="javascript:fGoto()">
</body>
</html>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章