我要在脚本里调用excel,怎么没反应啊?脚本代码如下:
function AutomateExcel()
{
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var table = document.all.data; //
var row = table.rows.length;
var column = table.rows(0).cells.length; // Add table headers going cell by
for (i=0;i<row;i++)
{
for (j=0;j<column;j++)
{
oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;
}
}
oXL.Visible = true;
oXL.UserControl = true;
}
alert("aaa");
}
这个函数是在点击一个按钮后调用,
<input type="button" name="out_word1" onclick="java script:AutomateExcel() " value="导出到excel" class="notPrint"/>
但问题是点了也没反应啊,不知道是怎么回事?请大家指点啊..非常谢谢
function AutomateExcel()
{
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var table = document.all.data; //
var row = table.rows.length;
var column = table.rows(0).cells.length; // Add table headers going cell by
for (i=0;i<row;i++)
{
for (j=0;j<column;j++)
{
oSheet.Cells(i+1,j+1).Value = table.rows(i).cells(j).innerText;
}
}
oXL.Visible = true;
oXL.UserControl = true;
}
alert("aaa");
}
这个函数是在点击一个按钮后调用,
<input type="button" name="out_word1" onclick="java script:AutomateExcel() " value="导出到excel" class="notPrint"/>
但问题是点了也没反应啊,不知道是怎么回事?请大家指点啊..非常谢谢
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货