<script language="javascript">
    var i;// 第10行代码
    
    setTimeout("abc()",5000);
    function abc(){
        // 第11行代码以后的全部放在这个函数里
        alert(1);
    }
</script>

解决方案 »

  1.   

    给你个例子看下<script>
    var i=1;
    var timeID=null;
    function display()
    {
      timeID = window.setInterval("delay()", 1000);
    }
    function delay()
    {
      if(i<10) 
      {
        alert(i);
        i++;
      }
      else
      {
        window.clearInterval(timeID);
      }
    }
    display();
    </script>
      

  2.   

    <script>function ok(){
    document.all("Button1").click();//调用后台单击事件
    //在这停留5秒
    ReturnValue();
    }
    function ReturnValue()
    {}
    </script>
      

  3.   

    <script> function ok(){ 
    document.all("Button1").click();//调用后台单击事件 
    //在这停留5秒 
    setTimeout("ReturnValue()",5000);// 等待5秒后才会执行你的ReturnValue函数

    function ReturnValue() 
    { } 
    </script>
      

  4.   

    可将代码分成两部分或做标记,然后调用setTimeout()来设置
      

  5.   

    我还是把文件贴出来吧,
    <html  xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
    <meta http-equiv="Expires" content="0"/>
    <script> function ok(){ 
    document.all("Button1").click();//调用后台单击事件 
    //在这停留5秒 
    ReturnValue(); 

    function ReturnValue() 

    var filename=document.form1.FileUpload1.value;
    filename=filename.substring(filename.lastIndexOf("\\")+1);
    var sFromUrl ="http://www.aaa.com/images/"+filename; //地址www.aaa.com是错的
     
    var sHTML = '<img src="'+sFromUrl+'"/>';
    window.returnValue = sHTML;
    window.close();//关闭后,返回另一个页面了

    </script>
    <title>插入图片</title>
    </head>
    <body bgColor="menu">
    <form id="form1" method="post" runat="server">
    <asp:FileUpload ID="FileUpload1"  runat="server" Width="178px"  />
    <input type="submit" value='确定' id="Ok" onclick="ok()" />
    </form>
    </body>
    </html>
      

  6.   

    <html  xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/> 
    <meta http-equiv="Expires" content="0"/> 
    <script> function ok(){ 
    document.all("Button1").click();//调用后台单击事件 
    //在这停留5秒 
    ReturnValue(); 

    function ReturnValue() 

    var filename=document.form1.FileUpload1.value; 
    filename=filename.substring(filename.lastIndexOf("\\")+1); 
    var sFromUrl ="http://www.aaa.com/images/"+filename; //地址www.aaa.com是错的 var sHTML = ' <img src="'+sFromUrl+'"/>'; 
    window.returnValue = sHTML; 
    window.close();//关闭后,返回另一个页面了 

    </script> 
    <title>插入图片 </title> 
    </head> 
    <body bgColor="menu"> 
    <form id="form1" method="post" runat="server"> 
    <asp:FileUpload ID="FileUpload1"  runat="server" Width="178px"  /> 
    <input type="submit" value='确定' id="Ok" onclick="ok()" /> 
    <asp:Button ID="Button1" runat="server" style="display:none;" Text="上传" OnClick="Button1_Click" />//后台是上传文件的代码
    </form> 
    </body> 
    </html>
      

  7.   

    要是用setTimeout() 的话,我就跳转不了其他的页面了