<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="javascript">
function doAdd()
{
otb = document.getElementById("aa"); //定义内表格对象otb。
var rowslegth = otb.rows.length; //获取当前层内表格的行数。
rowslegth = rowslegth +1;
oTr = otb.insertRow(otb.rows.length);
if(rowslegth%2!=0)
{
oTr.style.backgroundColor='#FFFFFF';
}
else
{
oTr.style.backgroundColor='#EFF7F9';
}
oTr.className = 'zi';
var Rowsid = otb.rows.length;
oTd = oTr.insertCell(0);//插入列
oTd.align = 'right';
oTd.className = 'list_td';
oTd.innerHTML="<select name='component_grid:_ctl"+rowslegth+":COMPONENT' id='component_grid__ctl"+rowslegth+"_selCOMPONENT' οnchange='ChangeCOMPONENT(this.options(this.selectedIndex).value,this.id)' size='1'><option selected='selected' value='0'>选择构件</option></select>";
oTd = oTr.insertCell(1);
oTd.align = 'left';
oTd.className = 'list_td';
oTd.innerHTML = "asdf";
oTd = oTr.insertCell(2);
oTd.align = 'center';
oTd.className = 'list_td';
oTd.innerHTML="<select name='component_grid:_ctl"+rowslegth+":selColor' id='component_grid__ctl"+rowslegth+"_selColor' size='1' οnchange='ChangeColor(this.options(this.selectedIndex).value,this.id);'><option selected='selected' value='0'>选择颜色</option></select>";
oTd = oTr.insertCell(3);
oTd.align = 'center';
oTd.className = 'list_td';
oTd.innerHTML="<input name='component_grid:_ctl"+rowslegth+":txtNum' type='text' id='component_grid__ctl'+rowslegth+'_txtNum' size='10' />";
oTd = oTr.insertCell(4);
oTd.align = 'center';
oTd.className = 'list_td';
oTd.innerHTML="<input name='component_grid:_ctl"+rowslegth+":txtLength' type='text' id='component_grid__ctl"+rowslegth+"_txtLength' size='10' />";
oTd = oTr.insertCell(5);
oTd.align = 'center';
oTd.className = 'list_td';
oTd.innerHTML="<input name='component_grid:_ctl"+rowslegth+":txtWidth' type='text' id='component_grid__ctl"+rowslegth+"_txtWidth' size='10' />";
oTd = oTr.insertCell(6);
oTd.align = 'center';
oTd.className = 'list_td';
oTd.innerHTML="<textarea name='component_grid:_ctl"+rowslegth+":txtDES' rows='2' cols='20' id='component_grid__ctl"+rowslegth+"_txtDES'></textarea>";
oTd = oTr.insertCell(7);
oTd.align = 'center';
oTd.className = 'list_td';
oTd.innerHTML="<a href='#' id='component_grid__ctl"+rowslegth+"_del' οnclick='DelRow(this);return false;'>删除</a>";
oTd = oTr.insertCell(8);
oTd.align = 'center';
oTd.className = 'disTd';
oTd.innerHTML="<input name='component_grid:_ctl"+rowslegth+":hidCOMPONENT_ID' id='component_grid__ctl"+rowslegth+"_hidCOMPONENT_ID' type='hidden' value='' />";
oTd = oTr.insertCell(9);
oTd.align = 'center';
oTd.className = 'disTd';
oTd.innerHTML="<input name='component_grid:_ctl"+rowslegth+":hidPROJECT_SHELFTYPE_COMPONENT_ID' id='component_grid__ctl"+rowslegth+"_hidPROJECT_SHELFTYPE_COMPONENT_ID' type='hidden' value='' />";
}
function DelRow(tableid)
{
objT=document.getElementById(tableid);
if(objT.rows.length==1)
{
alert("不可以删除首行");
return;
}
else
{
if(confirm("确定要删除吗?"))
{
objT.deleteRow();
}
}
}
</script>
</HEAD>
<BODY>
<input type="button" value="add" onClick="doAdd();">
<input type="button" value="del" onClick="DelRow('aa')">
<table id="aa" width="60%" border=1>
<tr><td>ssdddddd</td></tr>
</table>
</BODY>
</HTML>