js 导出word 兼容ie版
1.兼容IE8导入js
<script type="text/javascript" src="./jquery-1.8.2.min.js"></script> <!-- js导出word --> <script type="text/javascript" src="./FileSaver.js"></script> <script type="text/javascript" src="./excanvas-IE8.js"></script> <script type="text/javascript" src="./jqueryWordExport-IE8.js"></script>
不兼容IE导入js
<script type="text/javascript" src="./jquery-1.8.2.min.js"></script> <script type="text/javascript" src="./FileSaver.js"></script> <script type="text/javascript" src="./jquery.wordexport.js"></script>
2.导出方法
function print_page() { if (!!window.ActiveXObject || "ActiveXObject" in window) { //是否ie remove_ie_header_and_footer(); } //将id为showWord的div内容导出word,以下括号是导出文件名称 $("#downWord").wordExport("审核意见表"); }
3.设置id
<body id="downWord">
4.添加导出按钮(以下导出页面不显示按钮),<button>标签页面会显示按钮
<input name="BtnSave2" class="bc" id="BtnSave2" onclick="print_page()" type="button" value="导出">