在IE中调用javascript打开Excel(downmoon原作) 关键词 : javascript调用exc <! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > < HTML > < HEAD > < META http-equiv =Content-Type content ="text/html; charset=utf-8" > < TITLE > Top30销控表 </ TITLE > </ HEAD > < BODY > < input name ="shanghai" type ="button" class ="but" id ="shanghai" onClick ="StartExcel('上海')" value ="上海店" > < SCRIPT LANGUAGE ="Javascript" > ... var idTmr = "" ; function StartExcel(strFileName) ... { var oExcel; var oWorkbook; var strAllName; oExcel = new ActiveXObject( " Excel.Application " ); // if(strFileName=null || strFileName="") // {return; // } strAllName = " //ep-hgh/Top30销控表/TOP30招商续约销控表- " + strFileName + " .xls " ; oExcel.Workbooks.Open(strAllName); // oExcel.Workbooks.Open("file://ep-hgh/Top30销控表/TOP30招商续约销控表-上海.xls"); oExcel.DisplayAlerts = false ; oExcel.Visible = true ; // oExcel.Quit(); // oExcel = null; // 防EExcel死进程的关键!!必须!!!downmoon严重声明 idTmr = window.setInterval( " Cleanup(); " , 1000 ); } function Cleanup() ... { window.clearInterval(idTmr); CollectGarbage(); } </ SCRIPT > </ BODY > </ HTML >