您的位置主页 > 前端技术 > Javascript&js > javascript html table excel

javascript html table excel

2009-10-09    文章来源:互联网    浏览次数:298
 
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function CreateExcelSheet()
  5. {
  6.     var x=myTable.rows
  7.     var xls = new ActiveXObject("Excel.Application")
  8.     xls.visible = true
  9.     xls.Workbooks.Add
  10.     for (i = 0; i < x.length; i++)
  11.     {
  12.         var y = x[i].cells
  13.         for (j = 0; j < y.length; j++)
  14.         {
  15.             xls.Cells( i+1, j+1).Value = y[j].innerText
  16.         }
  17.     }
  18. }
  19. </script>
  20.  
  21. </head>
  22. <body marginheight="0" marginwidth="0">
  23. <form>
  24. <input type="button" onclick="CreateExcelSheet()" value="Create Excel Sheet">
  25. </form>
  26. <table id="myTable" border="1">
  27.     <tr>
  28.         <td>hao<td>
  29.         <td>hao<td>
  30.     </tr>
  31. </table>
  32. </body>
  33. </html>

 

  • 上一篇:php采集的函数
  • 下一篇:没有了
  • 文章评论(查看全部)

    验证码: 中评 好评 差评