div 覆蓋asp.net頁面

來源:互聯網
上載者:User
表單提交時的頁面覆蓋
當提交表單時,此時操作人員只需等待結果返回,這裡,我實現了一個覆蓋網頁的方法,使得整個網頁被一個很大的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。達到了想要的效果。
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=返回 onclick=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 onclick="javascript:fGoto()">
</body>
</html>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.