<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>网页上内容导出到word</title>
<script language="javascript">function OpenWord(){Layer1.style.border=0word = new ActiveXObject('Word.Application');word.Application.Visible = true;var mydoc=word.Documents.Add('',0,1);myRange =mydoc.Range(0,1)var sel=Layer1.document.body.createTextRange()sel.select()Layer1.document.execCommand('Copy')sel.moveEnd('character')myRange.Paste();location.reload()word.ActiveWindow.ActivePane.View.Type=9}</script>
</head><body><div id="Layer1" >EKING<input type=button name='button_export' title='导出到word' onclick="OpenWord()" value="导出到word"></div></div>
<p>测试导出--javascript</p><table align="center" width="300" border="1" bordercolor="#2baeff" cellpadding="0" cellspacing="0" bgcolor="lightblue"><Tr><Td>1</td><Td>2</td><Td>3</td></tr><Tr><Td>4</td><Td>5</td><Td>6</td></tr><Tr><Td>7</td><Td>8</td><Td>9</td></tr></table></body></html>
注意:要将active安全设置打开,不然就没反应
Copyright @ 2007-2012 敏韬网(敏而好学,文韬武略--MinTao.Net)(学习笔记) Inc All Rights Reserved. 闵涛 E_mail:admin@mintao.net(欢迎提供学习资源)
鄂公网安备 42011102001154号
站长:MinTao ICP备案号:鄂ICP备11006601号-18