function table2xls()
{
function String.prototype.Trim() {return this.replace(/(^\s*)|(\s*$)/g,"");}
try
{
var e = document.getElementById("tableName");
var s = ""
for (var j=0; j<e.rows.length; j++)
{
if (e.rows[0].cells[0].innerText.Trim() == "")
{
for (var i=1; i<e.rows[j].cells.length; i++)
s += e.rows[j].cells[i].innerText.Trim() +"\t";
}
else
{
for (var i=0; i<e.rows[j].cells.length; i++)
s += e.rows[j].cells[i].innerText.Trim() +"\t";
}
s += "\r\n";
}
var xlsWindow = window.open("","_blank","width=100,height=100");
xlsWindow.document.write(s);
xlsWindow.document.close();
xlsWindow.document.execCommand('Saveas',true,'%homeDrive%\\Data.xls')
xlsWindow.close();
}catch(e){}
}
{
function String.prototype.Trim() {return this.replace(/(^\s*)|(\s*$)/g,"");}
try
{
var e = document.getElementById("tableName");
var s = ""
for (var j=0; j<e.rows.length; j++)
{
if (e.rows[0].cells[0].innerText.Trim() == "")
{
for (var i=1; i<e.rows[j].cells.length; i++)
s += e.rows[j].cells[i].innerText.Trim() +"\t";
}
else
{
for (var i=0; i<e.rows[j].cells.length; i++)
s += e.rows[j].cells[i].innerText.Trim() +"\t";
}
s += "\r\n";
}
var xlsWindow = window.open("","_blank","width=100,height=100");
xlsWindow.document.write(s);
xlsWindow.document.close();
xlsWindow.document.execCommand('Saveas',true,'%homeDrive%\\Data.xls')
xlsWindow.close();
}catch(e){}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货