将html的table内容转换成excel表格输出 用firefox怎么实现
页面有一个table表格点击输出到excel中,ie浏览器实现,但是firefox怎么实现。下面是找的ie实现的代码:<%@pagecontentType="text/h...
页面有一个table表格 点击输出到excel中,ie浏览器实现,但是firefox怎么实现。下面是找的ie实现的代码:
<%@ page contentType="text/html; charset=UTF-8" language="java"
import="java.sql.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<TABLE id="outtable" name="outtable">
<TR>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
</TR>
<TR>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
</TR>
<TR>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
</TR>
<TR>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
</TR>
</TABLE>
<input type="button" name="out_excel" onclick="AutomateExcel();" value="导出到excel" class="notPrint">
<SCRIPT LANGUAGE="javascript">
function AutomateExcel()
{
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var hang = outtable.rows.length;
var lie = outtable.rows(0).cells.length;
for (i=0;i<hang;i++)
{
for (j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).value = outtable.rows(i).cells(j).innerText;
}
}
oXL.Visible = true;
oXL.UserControl = true;
}
</SCRIPT>
</body>
</html>
我现在想要在firefox下实现的方法 展开
<%@ page contentType="text/html; charset=UTF-8" language="java"
import="java.sql.*"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<TABLE id="outtable" name="outtable">
<TR>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
</TR>
<TR>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
</TR>
<TR>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
</TR>
<TR>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
<TD>asdf</TD>
</TR>
</TABLE>
<input type="button" name="out_excel" onclick="AutomateExcel();" value="导出到excel" class="notPrint">
<SCRIPT LANGUAGE="javascript">
function AutomateExcel()
{
var oXL = new ActiveXObject("Excel.Application");
var oWB = oXL.Workbooks.Add();
var oSheet = oWB.ActiveSheet;
var hang = outtable.rows.length;
var lie = outtable.rows(0).cells.length;
for (i=0;i<hang;i++)
{
for (j=0;j<lie;j++)
{
oSheet.Cells(i+1,j+1).value = outtable.rows(i).cells(j).innerText;
}
}
oXL.Visible = true;
oXL.UserControl = true;
}
</SCRIPT>
</body>
</html>
我现在想要在firefox下实现的方法 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询