Prodigy/kf智
我的博客
posts - 20,comments - 7,trackbacks - 0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script language="javascript">
function exportExcel(tableid)
{
if (typeof(EXPORT_OBJECT)!="object")
{
document.body.insertAdjacentHTML("afterBegin","<OBJECT style='display:none' classid=clsid:0002E510-0000-0000-C000-000000000046 id=EXPORT_OBJECT></Object>");
}
with (EXPORT_OBJECT)
{
DataType = "HTMLData";
HTMLData =tableid.outerHTML;
try{
ActiveSheet.Export("d:\\表格.xls", 0);
alert('成功导出EXCEL表格!');
}
catch (e)
{
alert('导出EXCEL表格失败,请确定已安装Excel2000(或更高版本),并且没打开同名xls文件');
}
}
}
</script>

<BODY>
<table id="tableid" border="1">
<tr><td>第一个单元格</td><td>第二个单元格</td><td>第三个单元格</td>
</tr>
<tr><td>第四个单元格</td><td>第五个单元格</td><td>第六个单元格</td>
</tr>
</table>
<input type="button" value="导出EXCEL表格" onclick="exportExcel(tableid)">
</BODY>
</HTML>

posted on 2006-03-28 22:58 xiaozhi 阅读(256) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: