子窗体中给父窗体动态创建表:
<script>
function Product(product_name,product_id,product_describe,AMOUNT_UNIT,COST_PRICE)
{
var arry= new Array("1",product_name,product_id,product_describe,AMOUNT_UNIT,COST_PRICE);
var Hiddfield=window.opener.document.getElementById("Hddf");
var table = window.opener.document.getElementById("tbDispalys");
var rowlength=table.rows.length;
for (var i=0;i<rowlength ;i++ )
{
if(table.rows[i].cells[2].innerText==product_id)//已存在
{
return;
}
}
var tr=table.insertRow();
var td=tr.insertCell();
td.innerHTML="<input type='checkbox' name='xuanze'/>";
for(var j=1;j<7;j++)
{
var td1=tr.insertCell();
if(j==4)
{
td1.innerHTML="<input type='text' value=1 class='textLine' />";
Hiddfield.value+=","+"1";
}
else if(j>4)
{
td1.innerText=arry[j-1];
Hiddfield.value+=","+arry[j-1];
}
else
{
td1.innerText=arry[j];
Hiddfield.value+=","+arry[j];
}
}
var td2=tr.insertCell();
td2.innerText=arry[5];
Hiddfield.value+=","+arry[5]+";";
}
</script>