我使用setTimeout 2秒后运行TUr()函数打开一个页面,在本地测试很正常,上传到服务器,就无法弹出了。
<script language="JavaScript">
   function DownLoad(){
document.all.apDiv1.style.display='';
setTimeout('TUrl()',2000); //指定2秒运行
}
function TUrl()
{
        window.open('/SysPrint/Manage/Otherwise/AuditingBackup_Excel.asp?tmp='+Math.random(),'Excel');
document.all.apDiv1.style.display='none';
}
</script>

解决方案 »

  1.   

    能帮忙调试一下吗?谢谢了
    1.asp
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <!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>Untitled Document</title>
    </head>
    <script language="JavaScript">
       function DownLoad(){
    setTimeout('TUrl()',1000); //指定1秒运行
    //window.open(2.asp?tmp='+Math.random(),'Excel');
    }
    function TUrl()
    {
    window.open(2.asp?tmp='+Math.random(),'Excel');
    }
    </script>
    <body>
    <span class="indiv"><img src="../Images/excel.gif" width="70" height="21" align="absmiddle" style="cursor:pointer" onclick="DownLoad()" /><iframe  name="Excel" style="display:none"></iframe></span>
    </body>
    </html>2.asp
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
    <%
    '查询数据'生成Excel
    Response.AddHeader "content-type","application/x-msdownload"
    Response.AddHeader "Content-Disposition","attachment;filename=1.xls"
    Response.charset="GB2312"
    %>
    <!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>Excel</title>
    </head><body>
    dfgdsgdfg
    </body>
    </html>
      

  2.   

    在本地测试很正常,上传到服务器,就无法导出excel了。 
    必须将js改成<script language="JavaScript"> 
      function DownLoad(){ 
    setTimeout('TUrl()',1000); //指定1秒运行 
    window.open(2.asp?tmp='+Math.random(),'Excel'); 

    function TUrl() 
    { } 
    </script>