<input type =“button”value =“export”onclick =“javascriptfunction”/>不调用chrome中的javascript函数

时间:2013-08-06 18:53:37

标签: javascript html

以下输入未调用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>

0 个答案:

没有答案