jquery
  • html
  • firefox
  • internet-explorer-8
  • 2010-11-30 57 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')不匹配,你的追加沒有效果。

    相關問題