以下输入未调用JavaScript函数TableToexcel
<html>
<body>
<input type="button" value="Export to Excel" onclick="TableToExcel('tbldataresult') "/>
<script type="text/javascript" language="javascript">
function TableToExcel(tableid) {
debugger;
var id = $('[id$="' + tableid + '"]');
var strCopy = $('<div></div>').html(id.clone()).html();
window.clipboardData.setData("Text", strCopy);
var objExcel = new ActiveXObject("Excel.Application");
objExcel.visible = false;
var objWorkbook = objExcel.Workbooks.Add;
var objWorksheet = objWorkbook.Worksheets(1);
objWorksheet.Paste;
objExcel.visible = true;
}
</script>
</body>
</html>