jquery
  • html
  • firefox
  • internet-explorer-8
  • 2010-11-30 93 views 0 likes 
    0
    function AddRow(){ 
    var rowCount = $("td.RowClass").length; 
    var currentIndex = 0; 
    if (rowCount > 0) 
    { 
        currentIndex = rowCount--; 
    } 
    
    var markup = '<tr>'; 
    markup += '<td class="RowClass" style="width:250px"><input type="text" id="TomId' + currentIndex + '" maxlength="78" size="70" /></td>'; 
    markup += '<td><input style="width:245px" type="text" id="SerialNumber' + currentIndex + '" maxlength="30" size="25" />&nbsp&nbsp'; 
    
    if (currentIndex >= 1) 
    { 
        markup += '<a id="removeTom' + currentIndex + '" href="#" onclick="RemoveTomControls(' + currentIndex + ')">Remove</a>'; 
    } 
    
    markup += '</td></tr>'; 
    $('#dataTable > tbody').append(markup); 
    } 
    

    这里是我追加到HTML:脚本在IE中工作,不工作在FF?

    <div style="height:340px; overflow:auto;"> 
          <table id="dataTable" style="margin:0px 1px 10px 5px; margin: width:800px;"> 
          </table> 
         </div> 
    
    +1

    任何错误信息?它在FF中做了什么?它应该做什么? – 2010-11-30 15:42:22

    +3

    “脚本在IE中运行,不能在FF中运行?”哈哈。所有的时间,所有的时间...... – 2010-11-30 15:44:58

    回答

    3

    火狐,IE浏览器不同,不会除非是在你的表中至少一个TR推断出tbody元素。

    因此$('#dataTable > tbody')不匹配,你的追加没有效果。

    相关问题