if (http.readyState = 1) 
document.getElmentById(...).innertext = 'loading...';

解决方案 »

  1.   

    我在网上找到下面的例子:因为他是为了测试用的,所以他用了sleep(2),就是停了2秒什么都不做,现在想换成当数据载入完成时再结束loading...应该怎么做才好一点呢?谢谢 。。
    <?phprequire("xajax.inc.php");function slow_function(){  $objResponse = new xajaxResponse();  sleep(2); //we'll do nothing for two seconds  $objResponse->addAlert("All done");  return $objResponse;}$xajax = new xajax();$xajax->registerFunction('slow_function');$xajax->processRequests();?><html>  <head>   <title>Loading Bar Demo</title>   <? $xajax->printJavascript(); ?>  </head>  <body>   <script type="text/javascript">   <!--   xajax.loadingFunction =   function(){xajax.$('loadingMessage').style.display='block';};   function hideLoadingMessage()   {   xajax.$('loadingMessage').style.display = 'none';   }   xajax.doneLoadingFunction = hideLoadingMessage;   // --></script>   <input type="button" onclick="xajax_slow_function();" value="Slow Function" />   <div id="loadingMessage" style="font-size: 22px; display: none;">   Loading...   </div>  </body>
      

  2.   

    innertext = 'loading<marquee>...</marquee>';
      

  3.   

    那请问一下require("xajax.inc.php");这是哪里来的呢?