<script>
function record_jituan_add() {
for(var a=1;a<document.getElementById("Table2").rows.length;a++)
{
document.getElementById("ipxingming_jituan").value=document.getElementById("Table2").rows[a].cells[0].innerText; //姓名
document.getElementById("ipkuangbie_jituan").value=document.getElementById("Table2").rows[a].cells[1].innerText; //矿别
var xingming=document.getElementById("ipxingming_jituan").value;
var jiguanchushi=document.getElementById("ipkuangbie_jituan").value;
var jituanid=document.getElementById("Table2").rows[a].cells[4].innerText; //每行的ID值
var selectkuang=document.getElementById(jituanid); //根据ID值取得每行的SELECT元素
alert(selectkuang.options[selectkuang.selectedIndex].innerText); //弹出选中值
// document.getElementById("Div1").innerHTML=Jituan_xiajing_addxiajing.AddXiajing_jituan(escape(xingming.toString()),escape(jiguanchushi.toString()),escape(kuang.toString()),document.getElementById("tbxriqi").value).value;
}
for(var rowcont=0;rowcont<document.getElementById("Table2").rows.length;rowcont++)
{
document.getElementById("Table2").deleteRow(1);
}
}
</script>
其中的var jituanid=document.getElementById("Table2").rows[a].cells[4].innerText; //每行的ID值由以下代码而来:
<script>
function shuangji_jituan(xingming,kuangbie,idvalue) //添加控件
{
for(var rowcont=0;rowcont<document.getElementById("Table2").rows.length;rowcont++)
{
if(document.getElementById("Table2").rows[rowcont].cells[0].innerText==xingming&&document.getElementById("Table1").rows[rowcont].cells[1].innerText==kuangbie)
{
document.getElementById("Div1").innerHTML="已添加过该人了";
return;
}
}
var nRow=document.all.Table2.rows.length; //获得当前TABLE的行数
var objTheRow=document.all.Table2.insertRow(nRow);//执行添加
objTheRow.insertCell(0);//添加当前行的列
objTheRow.insertCell(1);//添加当前行的列
objTheRow.insertCell(2);//添加当前行的列
objTheRow.insertCell(3);//添加当前行的列
objTheRow.insertCell(4);//添加当前行的列
objTheRow.cells(0).innerHTML="<a>"+xingming+"</a>";
objTheRow.cells(1).innerHTML="<a>"+kuangbie+"</a>";
objTheRow.cells(2).innerHTML="<select id='"+idvalue+"'></select>";
var depnum=Jituan_xiajing_addxiajing.GetDepNum().value;
for(var ddlcount=0;ddlcount<parseInt(depnum);ddlcount++)
{
var depname=Jituan_xiajing_addxiajing.GetDepName(ddlcount.toString()).value;
document.getElementById(idvalue.toString()).add(new Option(depname.toString(),depname.toString()));
}
objTheRow.cells(3).innerHTML="<img alt='' src='../images/010.gif' onclick='Delete_jituan()' />";
objTheRow.cells(4).innerHTML="<a style='display:none;'>"+idvalue+"</a>";
}
function Delete_jituan() //删除控件
{
var currRowIndex=event.srcElement.parentNode.parentNode.rowIndex;//获取当前索引
document.all.Table2.deleteRow(currRowIndex);//执行删除
}
</script>