weixin_33722405 2012-12-25 02:22 采纳率: 0%
浏览 59

jQuery AJAX加载IE6问题

I have a main HTML file with all the jQuery and JavaScript files included in it. Now I have a table which has a expand/collapse functionality. This table is in a different HTML file.

I am trying to load the table in the main file. I was successful in loading the table in the main HTML file but the expand/collapse is not working only in IE6/IE7. This works fine in FF, Chrome, Safari and IE8.

local.js has the expand/collapse code
table.html is the html file which has only the table code and no JavaScript.

MAIN HTML:

<html>
    <title>Main html</title>
    <head>
        <script type="text/javascript" src="jquery.js"></script>
        <script type="text/javascript" scr="localjs.js"></script>
        <script type="text/javascript">

            $('#ajaxtable').load('ajax/table.html', function() {
                alert('Table Loaded.');
            });

        </script>
    </head>

    <body>
        <div id="ajaxtable"></div>
    </body>
</html>

I can see the table gets loaded in the ajaxtable div but the expand/collapse is not working only in IE6.

  • 写回答

1条回答 默认 最新

  • weixin_33670786 2012-12-25 02:59
    关注

    As I mentioned in my comment above, you are loading localjs.js before the $('#ajaxtable') call. Attach the click handler after the table has been created and you should be fine...

    <script type="text/javascript">
    $('#ajaxtable').load('ajax/table.html', function() {
      alert('Table Loaded.');
      $('table tr.heading').click(function(){ $(tr.alpha).slideToggle('slow'); });
    });
    </script>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序