ie和FF 在insertRow和insertCell的区别
来源:互联网 发布:qq数据库.7z.001 编辑:程序博客网 时间:2024/05/01 06:46
在ie和FF中 insertRow和insertCell有着一个小小的区别,
有ie中可以这样调用:
var bgame_table = document.getElementById('game_table');
nowTR = bgame_table.insertRow();
nowTR = bgame_table.insertRow();
nowTD = nowTR.insertCell();
但在ff中,上面这样调用就会报错了:
FF和ie都可以这要调用:
var bgame_table = document.getElementById('game_table');
nowTR = bgame_table.insertRow(-1);
nowTR = bgame_table.insertRow(-1);
nowTD = nowTR.insertCell(-1);
-1代表什么意思呢?
原来-1代表:插入(行)单元格到 cells(rows) 集合内的最后一个。
ie默认值了-1,但FF就没有默认值的。
所以为了兼容性好,我建议大家都是加上-1
例子:
<html>
<script>
function testinsert(){
var bgame_table = document.getElementById('game_table');
nowTR = bgame_table.insertRow(-1);
with(nowTR){
nowTD = insertCell(-1);
<script>
function testinsert(){
var bgame_table = document.getElementById('game_table');
nowTR = bgame_table.insertRow(-1);
with(nowTR){
nowTD = insertCell(-1);
nowTD.className = 'b_hline';
nowTD.innerHTML ="00聯盟";
nowTD.innerHTML ="00聯盟";
nowTD = nowTR.insertCell(-1);
nowTD.align = 'left';
nowTD.innerHTML ="1111a---队 b 队 了";
nowTD = nowTR.insertCell(-1);
nowTD.align = 'left';
nowTD.innerHTML ="222 b 队 了";
nowTD.innerHTML ="222 b 队 了";
nowTD = nowTR.insertCell(-1);
nowTD.innerHTML ="3333a---队 了";
nowTD = nowTR.insertCell(-1);
nowTD.innerHTML ="4444a---队 了";
}
nowTR2 = bgame_table.insertRow(-1);
with(nowTR2){
nowTD = insertCell(-1);
nowTD.className = 'b_hline';
nowTD.innerHTML ="00聯盟";
nowTD.innerHTML ="00聯盟";
nowTD = nowTR2.insertCell(-1);
nowTD.align = 'left';
nowTD.innerHTML ="1111a---队 b 队 了";
nowTD = nowTR2.insertCell(-1);
nowTD.align = 'left';
nowTD.innerHTML ="222 b 队 了";
nowTD.innerHTML ="222 b 队 了";
nowTD = nowTR2.insertCell(-1);
nowTD.innerHTML ="3333a---队 了";
nowTD = nowTR2.insertCell(-1);
nowTD.innerHTML ="4444a---队 了";
}
}
</script>
<body onload="testinsert()">
<table id="game_table" width="526" border="0" cellspacing="1" cellpadding="0" class="b_tab" >
<tr class="b_tline_fu">
<td width="40" >時間</td>
<td width="200">主客a</td>
<!--<td width="40">suyi</td>-->
<td width="110" nowrap>foot</td>
<td width="110" nowrap>大小</td>
<td width="50">單雙</td>
</tr>
</table>
</body>
}
</script>
<body onload="testinsert()">
<table id="game_table" width="526" border="0" cellspacing="1" cellpadding="0" class="b_tab" >
<tr class="b_tline_fu">
<td width="40" >時間</td>
<td width="200">主客a</td>
<!--<td width="40">suyi</td>-->
<td width="110" nowrap>foot</td>
<td width="110" nowrap>大小</td>
<td width="50">單雙</td>
</tr>
</table>
</body>
</html>
- ie和FF 在insertRow和insertCell的区别
- 开发注意:在IE和FF中 insertRow和insertCell的区别
- insertRow和insertCell
- js的insertRow(-1)和insertCell(-1)
- 为何firefox不支持insertRow和insertCell。我如何能让firefox显示和ie显示的效果一样?iframe实现高度自适应,兼容FF、Opera、Safari
- javascript中insertRow(index) 和insertCell(index)
- chrome和ie在insertCell时的位置问题
- IE 和 FF 的区别?
- css在IE和FF中的区别
- 引用 js在IE和FF的区别
- IE和FF的边距区别
- FF和IE之间的区别
- IE和FF浏览器的区别
- JavaScript 在IE和FF的兼容性问题
- 关于FF和IE在Javascript和CSS的区别的收集
- 在ie和ff下文档height区别
- date.parse在IE和FF中的区别
- date.parse在IE和FF中的区别
- 在Visual C++中用ADO进行数据库编程(下)
- 了解何时使用 Override 和 New 关键字(C# 编程指南)
- s3c2410触摸屏驱动(2.6内核)分析
- 用MFC创建菜单按钮
- 股市里你在投资还是在投机?---睁大你的眼睛
- ie和FF 在insertRow和insertCell的区别
- C# 索引器
- 2.6内核输入子系统分析
- .net如何调用未注册COM的非托管的dll
- 本人写的第一个 brainfuck 程序
- 2.6内核输入子系统分析-续
- 输入子系统--event层分析
- [VC/MFC]图标菜单(菜单图标)的实现
- 保险是消费还是投资?