<html><head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<SCRIPT LANGUAGE="javascript">
function table2xls()
{
  function String.prototype.Trim() {return this.replace(/(^\s*)|(\s*$)/g,"");}
  try
  {
    var e = document.getElementById("Table1");
    var s = ""
    for (var j=0; j<e.rows.length; j++)
    {
      if (e.rows[0].cells[0].innerText.Trim() == "")
      {
        for (var i=1; i<e.rows[j].cells.length; i++)
          s += e.rows[j].cells[i].innerText.Trim() +"\t";
      }
      else
      {
        for (var i=0; i<e.rows[j].cells.length; i++)
          s += e.rows[j].cells[i].innerText.Trim() +"\t";
      }
      s += "\r\n";
    }
    var xlsWindow = window.open("","_blank","left=-1,top=-1,width=100,height=100");
    xlsWindow.document.write(s);
    xlsWindow.document.close();
    alert(xlsWindow.document.body.innerHTML);
    xlsWindow.document.execCommand('Saveas',true,'%homeDrive%\\aaaa.xls')
    xlsWindow.close();
  }catch(e){}
}</script>
<body>
<input type="button" value="excel" onclick="table2xls()">
aaa表
<table border="1" width="100%" height="65" id="Table1">
  <tr>
    <td width="25%" height="16">名称</td>
    <td width="25%" height="16">性别</td>
    <td width="25%" height="16">ffff</td>
    <td width="25%" height="16">ffff</td>
  </tr>
  <tr>
    <td width="25%" height="15">dfdd</td>
    <td width="25%" height="15">dffdfd</td>
    <td width="25%" height="15">fdfd</td>
    <td width="25%" height="15">fdfdg</td>
  </tr>
  <tr>
    <td width="25%" height="16">fvsd</td>
    <td width="25%" height="16">aAAA</td>
    <td width="25%" height="16">GGGGG</td>
    <td width="25%" height="16">43444</td>
  </tr>
</table></body></html>