<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script type="text/javascript">
var retime=50; //循环时间 单位毫秒
var res=0;
function re(){
res++;
document.getElementById("tx").value=res;
setTimeout("re()",retime);
}
window.onload=re;
</script>
</head><body>
<input type="text" id="tx" />
</body>
</html>

解决方案 »

  1.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script language="javascript">
    function re(sec){
      for (i=1;i<100;i++){
    document.getElementById("tx").value=i;
    var   now   =   new   Date();   
                    var   exitTime   =   now.getTime()   +   sec*1000; 
                    //alert (now.getTime()) ; 
                      while   (true)   {   
                              now   =   new   Date();   
                              if   (now.getTime()   >   exitTime)   
                                   break;   
                      }                }
    }

    </script>
    </head><body>
    <input type="text" id="tx" /><br>
    延迟:秒<input type="text" id="sec" /><input type="button" value="ok" onclick="re(document.getElementById('sec').value)"></body>
    </html>
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script type="text/javascript">
    var retime=50; //循环时间 单位毫秒
    var res=0;
    function re(){
    res++;
    document.getElementById("tx").value=res;
    setTimeout("re()",retime);
    }
    window.onload=re;
    </script>
    </head><body>
    <input type="text" id="tx" />
    </body>
    </html>
      

  3.   

    看看这个吧http://bbs.51js.com/viewthread.php?tid=66361&highlight=%D4%DD%CD%A3%2B%D4%C2%D3%B0