使用jQuery将表导出到Excel
我有一个html页面,其中有一个表,我想将表数据导出到Excel文件 我使用了以下代码:使用jQuery将表导出到Excel,jquery,excel,Jquery,Excel,我有一个html页面,其中有一个表,我想将表数据导出到Excel文件 我使用了以下代码: <head> <title>Email application</title> <script src="Scripts/jquery-2.1.1.js"></script> <script src="Scripts/jquery-2.1.1.min.js"></script> <script type="text/j
<head>
<title>Email application</title>
<script src="Scripts/jquery-2.1.1.js"></script>
<script src="Scripts/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
$("#BtnSendMessage").click(function(e) {
window.open('data:application/vnd.ms-excel,' + encodeURIComponent($('#TblExport').html()));
e.preventDefault();
}) </script></head>
电子邮件应用程序
$(“#BtnSendMessage”)。单击(函数(e){
open('data:application/vnd.ms excel,'+encodeURIComponent($('#TblExport').html());
e、 预防默认值();
})
我的Html页面:
<body>
<table id="TblExport">
<tr>
<td><input type="text" id="TxtName" /></td>
<td><input type="text" id="TxtEmail" /></td>
</tr>
<tr>
<td colspan="2">
<textarea id="TxtMessage"></textarea>
</td>
</tr>
<tr>
<td><input type="button" id="BtnSendMessage" value="SendMessage" /></td>
<td><label id="LblErrorMessage"></label></td>
</tr>
</table>
现在,单击按钮后,什么都没有发生。如果您可以设置一个JSFIDLE,这将非常有用。:)您是否包含了调用btechco_excelexport的脚本的引用?在高级
$datatype
未定义。i、 你错过了一些js文件。什么是btechco\u excelexport
?它从哪里来?@Popeye我编辑了我的代码。@SherinMathew我编辑了我的代码