您的位置:首页 > 其它

table.insertRow() firefox和IE下的兼容问题

2010-08-26 10:30 513 查看
最近做了个Struts2.0的文章发布系统,使用dwr的框架,没想到在firefox下的兼容问题却不好,所以自己网上找了下才知道如何解决,本身我对js也不熟悉,web要学的东西还真多,哎。

table.insertRow()在IE下没问题 但在firefox下就得改为table.insertRow(-1)

同样其相应的insertCell()也要改为insertCell(-1)

var
newTh =
table
.
insertRow
(
-
1)
;

newTh.
style
.
backgroundColor
=
"#C8ECEC"
;

newTh.
align
=
"center"
;

//表头TD

var
newTh1 =
newTh.
insertCell
(
-
1)
;

var
newTh2 =
newTh.
insertCell
(
-
1)
;

var
newTh3 =
newTh.
insertCell
(
-
1)
;

var
newTh4 =
newTh.
insertCell
(
-
1)
;

http://blog.chinaunix.net/u2/65552/showart_1211865.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: