JS事件处理等待代码

脚本说明:
 
把如下代码加入<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="处理等待" οnclick="do_totals1()">
  </p> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值