<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<SCRIPT LANGUAGE="javascript">
function table2xls()
{
function String.prototype.Trim() {return this.replace(/(^\s*)|(\s*$)/g,"");}
try
{
var e = document.getElementById("Table1");
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","left=-1,top=-1,width=100,height=100");
xlsWindow.document.write(s);
xlsWindow.document.close();
alert(xlsWindow.document.body.innerHTML);
xlsWindow.document.execCommand('Saveas',true,'%homeDrive%\\aaaa.xls')
xlsWindow.close();
}catch(e){}
}</script>
<body>
<input type="button" value="excel" onclick="table2xls()">
aaa表
<table border="1" width="100%" height="65" id="Table1">
<tr>
<td width="25%" height="16">名称</td>
<td width="25%" height="16">性别</td>
<td width="25%" height="16">ffff</td>
<td width="25%" height="16">ffff</td>
</tr>
<tr>
<td width="25%" height="15">dfdd</td>
<td width="25%" height="15">dffdfd</td>
<td width="25%" height="15">fdfd</td>
<td width="25%" height="15">fdfdg</td>
</tr>
<tr>
<td width="25%" height="16">fvsd</td>
<td width="25%" height="16">aAAA</td>
<td width="25%" height="16">GGGGG</td>
<td width="25%" height="16">43444</td>
</tr>
</table></body></html>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<SCRIPT LANGUAGE="javascript">
function table2xls()
{
function String.prototype.Trim() {return this.replace(/(^\s*)|(\s*$)/g,"");}
try
{
var e = document.getElementById("Table1");
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","left=-1,top=-1,width=100,height=100");
xlsWindow.document.write(s);
xlsWindow.document.close();
alert(xlsWindow.document.body.innerHTML);
xlsWindow.document.execCommand('Saveas',true,'%homeDrive%\\aaaa.xls')
xlsWindow.close();
}catch(e){}
}</script>
<body>
<input type="button" value="excel" onclick="table2xls()">
aaa表
<table border="1" width="100%" height="65" id="Table1">
<tr>
<td width="25%" height="16">名称</td>
<td width="25%" height="16">性别</td>
<td width="25%" height="16">ffff</td>
<td width="25%" height="16">ffff</td>
</tr>
<tr>
<td width="25%" height="15">dfdd</td>
<td width="25%" height="15">dffdfd</td>
<td width="25%" height="15">fdfd</td>
<td width="25%" height="15">fdfdg</td>
</tr>
<tr>
<td width="25%" height="16">fvsd</td>
<td width="25%" height="16">aAAA</td>
<td width="25%" height="16">GGGGG</td>
<td width="25%" height="16">43444</td>
</tr>
</table></body></html>
解决方案 »
- 关于!ispostback 和 public static 变量的疑问
- .NET C# 输入字符串的格式不正确。
- theForm._EventTarget 为空或不是对象 点击下一页时出现此提示
- AdRotator控件能不能不刷新就循环显示图片呢,为什么只有刷新的时候才会更换图片呢?
- 请教asp.net中页面历史记录的问题?
- 在线等! 有关POP3邮件问题,接收到的邮件内容分解出来了,但里面的内嵌资源怎么处理啊!Up也有分!
- 请问Asp.net如可使用重置按钮?
- 怎样判断session是否过期?
- 请教各位大侠两个困扰很久的两个问题!!!
- icyer() 请进
- 各位,帮忙看一下!!!
- 关于XML的问题
这句不要它