< DOCTYPE html PUBLIC -WCDTD XHTML StrictEN httpwwwworgTRxhtmlDTDxhtml-strictdtd>
function toExcel(tablename){ //導出到excel
var mysheet=new ActiveXObject("OWC.Spreadsheet");
with(mysheet){
DataType = "HTMLData";
HTMLData =tablename.outerHTML;
try{
ActiveSheet.Cells(1,1).value="";
ActiveSheet.Cells(2,1).value="";
// ActiveSheet.Cells(34,1).value="導出完畢";
ActiveSheet.Export("c:\\前6周發貨預測系數表.xls", 0);
alert('導出完畢');
window.close();
}; catch (e){
alert('導出Excel表失敗,請确定已安裝Excel2000(或更高版本),并且沒打開同名xls檔案');
window.close();
本文轉自 netcorner 部落格園部落格,原文連結:http://www.cnblogs.com/netcorner/archive/2007/04/02/2912401.html ,如需轉載請自行聯系原作者