2005/06/12 | javascript怎么操作EXCLE???
类别(WEB相关) | 评论(0) | 阅读(105) | 发表于 23:00
<SCRIPT LANGUAGE="javascript">
function CopyToExcel()
{
holdtext.innerText =document.all("myTable").outerHTML
Copied = holdtext.createTextRange();
Copied.execCommand("Copy");
excelObj = new ActiveXObject("Excel.Application");
excelObj.Visible = true;
excelObj.WorkBooks.Add;
excelObj.ActiveSheet.Paste;
}
</SCRIPT>
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
<table id=mytable>
<tr><td>1</td></tr>
<tr><td>2</td></tr>
<tr><td>3</td></tr>
<tr><td>4</td></tr>
</table>
<input type="button" value="转到Excel" onClick="CopyToExcel()" >

0

评论Comments