54、事件处理等待

54、事件处理等待

脚本说明:

把如下代码加入<body>区域中

              <script language="javascript">

 

              function do_totals1()

 

              {

 

              document.all.pleasewaitScreen.style.pixelTop = (document.body.scrollTop + 50);

 

              document.all.pleasewaitScreen.style.visibility="visible";

 

              window.setTimeout('do_totals2()',1);

 

              }    

 

             

 

              function do_totals2()

 

              {

 

              lengthy_calculation();

 

              document.all.pleasewaitScreen.style.visibility="hidden";

 

              }

 

             

 

              function lengthy_calculation()

 

              {

 

              var x,y

 

             

 

              for(x=0;x<1000000;x++)

 

                     {

 

                     y += (x * y) / (y - x);                 

 

                     }

 

              }

             

              </script>

              <DIV ID="pleasewaitScreen" STYLE="position:absolute;z-index:5;top:30%;left:42%;visibility:hidden">

                     <TABLE BGCOLOR="#000000" BORDER="1" BORDERCOLOR="#000000" CELLPADDING="0" CELLSPACING="0" HEIGHT="100" WIDTH="150" ID="Table1">

                            <TR>

                                   <TD WIDTH="100%" HEIGHT="100%" BGCOLOR="silver" ALIGN="CENTER" VALIGN="MIDDLE">

                                          <FONT FACE="Arial" SIZE="4" COLOR="blue"><B>正在处理中<br>

                                                        请稍等...</B></FONT>

                                   </TD>

                            </TR>

                     </TABLE>

              </DIV>

              <p align="center">

                     <input type="button" name="btn_calc" value="处理等待" onclick="do_totals1()">

              </p>

 

Write a comment

Comments: 0