首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

DOM 对报表的操作 兼容 火狐和IE

2012-10-06 
DOM对表格的操作兼容 火狐和IE//valueTable 中插入列 function addRow(){//设置列内容和属性var newTr v

DOM 对表格的操作 兼容 火狐和IE

//valueTable 中插入列 function addRow()        {        //设置列内容和属性var newTr = valueTable.insertRow(-1);//添加两列var newTd0 = newTr.insertCell(-1);var newTd1 = newTr.insertCell(-1);var newTd2 = newTr.insertCell(-1);newTd0.align='center'; newTd0.innerHTML = "<input name='userInputName' onChange='checkDot(this);' maxlength='32' type='text' />"; newTd1.align='center'; newTd1.innerHTML="<input name='detectName' onChange='checkDot(this);' maxlength='32' type='text' />";newTd2.align='center'; newTd2.innerHTML="<a  class='edit' href="#" onclick="DelTR(this);">删除</a>";        }//删除 该列function DelTR(obj){if(confirm("是否将表单此属性删除?")){var seq=obj.parentNode.parentNode.rowIndex;var oTab = valueTable;var trLen = oTab.rows.length;    oTab.deleteRow(seq);}}

<table id="valueTable" cellspacing="1"cellpadding="0"><thead><th  width="50%">项目名称</th><th  width="25%">值</th><th > 操作</th></thead><tbody></tbody></table>

热点排行
Bad Request.