Thanks for any help in advance!
I have this order form where you add rows as you need them. The
routine to add fields is working fine. I am trying to add the ability
to delete rows if you check the checkbox in the cooresponding field
and click remove item.
I would appreciate any insite. BTW Am using IE browsers only.
Thanks!
<SCRIPT LANGUAGE="JScri pt">
var oRow;
var box;
var itemquantity;
var itemdescription ;
var itemtax;
var itemprice;
var itemserial;
function addvalue(f)
{
var oCell;
var i, j;
var check="";
// Insert rows and cells into the first body.
//Get the current row count. Then change item name number
for(i=0; i<1;i++)
{
//Get the row count to make distinct field names
varItem=oTable. rows.length;
//Start Entering At Top Of Table
oTBody0.scrollT op=true;
//Insert A New Row
oRow = oTBody0.insertR ow();
//Insert New Action Cell
oCell = oRow.insertCell ();
box = "<INPUT type=checkbox class=checkbox name=checkbox id=chkBX
value=check >";
oCell.innerHTML = box
//Insert New Quantity Cell
oCell = oRow.insertCell ();
itemquantity = "<input type=text size=8 name=ItemQuanti ty_"
+varItem+ ">";
//itemquantity = "<input type=text name=Item_Quant ity_1 size=8>";
oCell.innerHTML = itemquantity
//Insert New Description Cell
oCell = oRow.insertCell ();
itemdescription = "<input type=text size=60 name=ItemDescri ption_"
+varItem+ ">";
oCell.innerHTML = itemdescription
//Insert New Serial Cell
oCell = oRow.insertCell ();
itemserial = "<input type=text size=12 name=ItemSerial _" +varItem+
">";
oCell.innerHTML = itemserial
//Insert Unit Price Cell
oCell = oRow.insertCell ();
itemprice = "<input type=text size=9 name=ItemPrice_ " +varItem+
">";
oCell.innerHTML = itemprice
//Insert New Tax Cell
oCell = oRow.insertCell ();
itemtax = "<input type=text size=3 name=ItemTax_" +varItem+ ">";
oCell.innerHTML = itemtax
}
}
function removevalue()
{
if(oTable.rows. length>0)
{
for(var i=7; i<(oTable.rows. length+7); i++)
{
alert(oTable.ro ws.length)
alert(document. forms[0].elements[i].value+" ALERTING")
if(document.for ms[0].elements[i].checked==true)
{
alert(oTable.ro ws.length)
//oRow.sectionRow Index=i;
alert(box.value +"ooooooooooooo ooooo")
oTable.deleteRo w(oTable.rows[i])
}
}
}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" >
<form action="" name="test" id="test">
<tr>
<td width="100%" colspan="100%">
<input type="button" name="add" value="Add Item" class="button"
onClick="addval ue(this.form)">
<input type="button" name="remove" value="Remove Item"
class="button" onClick="remove value(this)">
</td>
</tr>
</table>
<BR>
<table width="100%" border="0" cellspacing="0" cellpadding="0"
id="oTable">
<TBODY ID="oTBody0">
<tr>
<td class="label">& nbsp;</td>
<td class="label">Q uantity:</td>
<td class="label">I tem:</td>
<td class="label">S erial:</td>
<td class="label">U nit Price:</td>
<td class="label">T ax:</td>
</tr>
</TABLE>
</FORM>
cr********@hotm ail.com