开发者

HTML table cells aren't uniform width in Firefox, fine in Chrome and IE8

开发者 https://www.devze.com 2023-01-18 07:21 出处:网络
I\'m working on an app in ASP.NET MVC 2, and the output of the table looks the way I\'d expect in Chrome and IE8:

I'm working on an app in ASP.NET MVC 2, and the output of the table looks the way I'd expect in Chrome and IE8:

HTML table cells aren't uniform width in Firefox, fine in Chrome and IE8

but this is how it looks in FF 3.6.8 it looks like this:

HTML table cells aren't uniform width in Firefox, fine in Chrome and IE8

I'm using Javascript开发者_JAVA百科/jQuery to add rows, this is the code:

        function onAddItem() {
        itemCount = itemCount + 1;
        var rowString = "<tr id=" + itemCount + ">";
        rowString = rowString + "<td>" + document.getElementById("Order_productcode").value + "</td>";
        rowString = rowString + "<td>" + document.getElementById("Order_productsku").value + "</td>";
        rowString = rowString + "<td>" + document.getElementById("Order_productdesc").value + "</td>";
        rowString = rowString + "<td align=\"right\">" + document.getElementById("ItemQuantity").value + "</td>";
        rowString = rowString + "<td>" + document.getElementById("Order_productweight").value + "</td>";
        rowString = rowString + "<td>" + document.getElementById("Order_productcost").value + "</td>";
        rowString = rowString + "</tr>";
        $row = $(rowString);
        $row.hide().fadeIn("slow").appendTo("#orderedItems table tbody");
    }

Looking in Firebug, I found the row that gets created looks like this:

 <tr style="display: block;" id="1"><td>EC5931A-Tote</td><td>100002</td><td></td><td align="right"></td><td>0</td><td>33250.00</td></tr></tbody>

that is, it adds style="display: block;", which seems to be the problem (when I edited it out in Firebug, it looked correct, i.e., like in IE and Chrome). Why is Firefox doing that, and how can I make it stop?

EDIT: I removed the .hide().fadeIn("slow") and now it's working correctly in Firefox. Seems to be a bug in jQuery with Firefox, although I didn't see it on the jQuery site.

0

精彩评论

暂无评论...
验证码 换一张
取 消