htm页面l导出excel表格

来源:互联网 发布:百度网盘老是网络异常 编辑:程序博客网 时间:2024/05/02 03:01
<html>  
<head>  
<title>Export html table to excel and csv using jquery</title>  
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">  
<script type="text/javascript" src="./js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="./jquery.base64.js"></script>  
<script type="text/javascript" src="./tableExport.js"></script>  
<script type="text/javascript" src="./sprintf.js">  </script> 
<script type="text/javascript" src="./jspdf.js">  </script>
</head>  
<body>  
<br><br><br>            
<button class="btn btn-success" onClick ="$('#customers').tableExport({type: 'excel', escape: 'false'});">Excel Export</button>  
<button class="btn btn-success" onClick ="$('#customers').tableExport({type: 'pdf', escape: 'false'});">CSV Export</button>  
<br><br>  
<table id="customers" class="table table-striped table-bordered" >  
<thead>             
<tr class='warning'>  
<th>栏目1</th>  
<th>栏目2</th>  
<th>栏目3</th>  
</tr>  
</thead>  
<tbody>  
<tr>  
<td>1</td>  
<td>2</td>  
<td>3</td>  
</tr>  
<tr>  
<td>1</td>  
<td>2</td>  
<td>3</td>  
</tr>  
<tr>  
<td>1</td>  
<td>2</td>  
<td>3</td>  
</tr>  
<tr>  
<td>1</td>  
<td>2</td>  
<td>3</td>  
</tr>  
<tr>  
<td>1</td>  
<td>2</td>  
<td>3</td>  
</tr>  
</tbody>  
</table>   
</div>  
</body>  
</html>  
0 0
原创粉丝点击