您的位置:首页 > Web前端 > JavaScript

js 导出Excel

2011-01-06 21:44 483 查看
JS方法:
<script type="text/javascript">
function excelPrint(objStr){
var tempStr = document.getElementById('sort_table').outerHTML;
var newWin = window.open();
newWin.document.write(tempStr);
newWin.document.close();
newWin.document.execCommand('saveas',true,objStr+'.xls');
newWin.window.close();
}
</script>

调用:

<input type="button" name="button2" value="导出EXCEL表格" onclick="excelPrint('13838325555,01月01日--01月25日详单');" style="cursor:hand"/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: