<div class="htmlarea"> <textarea id="runcode64266"> <script language="javascript"> function AllAreaExcel(ID) { var oXL = new ActiveXObject("Excel.Application"); var oWB = oXL.Workbooks.Add(); var oSheet = oWB.ActiveSheet; var sel=document.body.createTextRange(); sel.moveToElementText(ID); sel.select(); sel.execCommand("Copy"); oSheet.Paste(); oXL.Visible = true; } </script> 使用:利用<div id="test">要保存的页面内容</div> <input type="button" onclick="AllAreaExcel(test)" value="保存为Excel">点击按钮后即可. </textarea><br><input onclick="runEx('runcode64266')" type="button" value="运行代码"> <input onclick="doCopy('runcode64266')" type="button" value="复制代码"> <input onclick="doSave(runcode64266)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>