Javascript 使用jquery将表格内容导出到不在IE 8中工作的excel

Javascript 使用jquery将表格内容导出到不在IE 8中工作的excel,javascript,jquery,html,firefox,internet-explorer-8,Javascript,Jquery,Html,Firefox,Internet Explorer 8,在这里,我尝试将表格内容导出到excel。它在Firefox中运行良好。但它在IE8中不起作用。有人能帮我解决这个问题吗?我在这里使用了jquery。如果可以同时使用javascript,我也同意 <html> <head> <script src="http://code.jquery.com/jquery-1.11.1.js"></script> <script> $(

在这里,我尝试将表格内容导出到excel。它在Firefox中运行良好。但它在IE8中不起作用。有人能帮我解决这个问题吗?我在这里使用了jquery。如果可以同时使用javascript,我也同意

<html>
    <head>
        <script src="http://code.jquery.com/jquery-1.11.1.js"></script>
        <script>
            $(document).ready(function() {
                $("[id$=excellink]").click(function(e) {
                    alert("$('div[id$=dvData]').html()");
                    window.open('data:application/vnd.ms-excel,' + encodeURIComponent( $('div[id$=dvData]').html()));
                    e.preventDefault();
                });
            });
        </script>
        <body>
            <br/>
            <div id="dvData">
                <table>
                    <tr>
                        <th>Billing System</th>
                        <th>Market Code</th>
                        <th>Payment Amount</th>
                    </tr>
                    <tr>
                        <td>RED</td>
                        <td>222</td>
                        <td>$103.00</td>
                    </tr>
                    <tr>
                        <td>BLUE</td>
                        <td>111</td>
                        <td>$13.00</td>
                    </tr>
                    <tr>
                        <td>GREEN</td>
                        <td>555</td>
                        <td>$143.00</td>  
                    </tr>
                </table>
            </div>
            <br/>
            <input type="button" id="excellink" value="Excel" />

        </body>
    </head>
</html>

$(文档).ready(函数(){
$(“[id$=excellink]”。单击(函数(e){
警报($('div[id$=dvData]').html();
open('data:application/vnd.ms excel,'encodeURIComponent($('div[id$=dvData]')).html());
e、 预防默认值();
});
});

计费系统 市场代码 付款金额 红色 222 $103.00 蓝色 111 $13.00 绿色 555 $143.00

尝试添加以下特定于IE 8的代码

    <!--[if eq IE 8]>
        <script>
                    $(document).ready(function() {
                        $("[id$=excellink]").click(function(e) {
                            alert("$('div[id$=dvData]').html()");
                            window.open('data:application/vnd.xls,' + encodeURIComponent( $('div[id$=dvData]').html()));
                            e.preventDefault();
                        });
                    });
                </script>
<![endif]-->


“不工作”。。。您是否收到任何错误?IE8是否支持
数据:
URL?我的感觉是没有。@Pointy我心里也有同样的想法。。哈哈..From:
Internet Explorer 8中的支持仅限于图像和链接资源,如CSS文件,而不是HTML文件。IE8中的最大URI长度为32KB。
在IE8中,它将重定向到新窗口并在URL中显示表的值。。