js——實現當前網頁中的代碼導入到word中

             把當前網頁中的代碼導入到word中,會啟動本地word,,, 還是不錯的,而且代碼量很少。 嘿嘿
          <html>
          <head>
          <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
          <title>網頁上內容導出到word</title>
          </head>
          <body>
          <div id="Layer1" >Happy New Year ! ! !
          <input type=button name='button_export' title='導出到word'  onclick=OpenWord() value=下載到word></div>
          </div>
          <input type='button' value='fullscreen' onClick="window.open('c:\\a.html','fullscreen','fullscreen,scrollbars');">

          <input name="but1" type="button" onClick="window.open('b.html');" value="b.html">
          <iframe name="iframe2" src=""></iframe>

          <p>this is a test!</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>

          <input type="checkbox" id="chk">chkTest<br><br>
          <input type="button" name="testOpen" value="openWindow" onClick="var newWindow = window.open('a.html');newWindow.document.all('chk').checked = true;">
          </body>
          </html>
          <script language="javascript">
          function OpenWord(){
          Layer1.style.border
          =0
          ExcelSheet 
          = new ActiveXObject('Word.Application');
          ExcelSheet.Application.Visible 
          = true;
          var mydoc=ExcelSheet.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()
          ExcelSheet.ActiveWindow.ActivePane.View.Type
          =9
          }
          </script>

          posted on 2009-04-16 20:32 胡鵬 閱讀(1389) 評論(0)  編輯  收藏 所屬分類: js,html,css

          導航

          <2009年4月>
          2930311234
          567891011
          12131415161718
          19202122232425
          262728293012
          3456789

          統計

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          agile

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 昌平区| 竹山县| 寻甸| 迁西县| 耒阳市| 昌吉市| 阜城县| 广灵县| 怀柔区| 宜兰县| 武功县| 富平县| 水富县| 花莲市| 大兴区| 安化县| 嫩江县| 土默特左旗| 湖南省| 桦南县| 南和县| 绥宁县| 邯郸市| 芜湖市| 宕昌县| 来安县| 朔州市| 尉氏县| 凤翔县| 涿鹿县| 东丰县| 舞阳县| 汉源县| 疏附县| 高雄县| 璧山县| 嘉禾县| 蒙阴县| 灌云县| 洮南市| 凤山市|