[HTML]
<html>
<head>
<title>Me</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script language="javascript">
rowid = 1;
doc = document;
function delRow (elemToDel) {
if (!elemToDel) return;
elemToDel.parentNode.removeChild(elemToDel);
}
function addRowTo(id) {
var tbl = doc.getElementById(id);
var newrow = doc.createElement("TR");
var newcol , newinput;
//rowid
newcol = doc.createElement("TD");
newcol.width = 30;
newcol.title = "ReadOnly";
newcol.align = "center";
newinput = doc.createElement("input");
newinput.name = "rowid"+rowid;
newinput.size = 2;
newinput.value = ""+rowid;
newinput.readonly = "readonly";
newcol.appendChild(newinput);
newrow.appendChild(newcol);
//hardware
newcol = doc.createElement("TD");
newcol.width = 150;
newcol.align = "center";
newinput = doc.createElement("input");
newinput.name = "hardware"+rowid;
newinput.size = 30;
newinput.value = "";
newcol.appendChild(newinput);
newrow.appendChild(newcol);
//brand
newcol = doc.createElement("TD");
newcol.width = 150;
newcol.align = "center";
newinput = doc.createElement("input");
newinput.name = "brand"+rowid;
newinput.size = 30;
newinput.value = "";
newcol.appendChild(newinput);
newrow.appendChild(newcol);
//price
newcol = doc.createElement("TD");
newcol.width = 150;
newcol.align = "center";
newinput = doc.createElement("input");
newinput.id = "price"+rowid;
newinput.name = "price"+rowid;
newinput.size = 30;
newinput.value = "";
newcol.appendChild(newinput);
newrow.appendChild(newcol);
//tool
newcol = doc.createElement("TD");
newcol.width = 20;
newcol.align = "center";
newinput = doc.createElement("input");
newinput.setAttribute("type","image");
newinput.name = "destroy"+rowid;
newinput.src="i_delete.gif";
newinput.onclick=new Function ("delRow(document.getElementById('row"+rowid+"')); ");
newcol.appendChild(newinput);
newrow.appendChild(newcol);
tbl.appendChild(newrow);
rowid++;
//document.main.hardware.value = '';
//document.main.brand.value = '';
//document.main.end.value = '';
//document.main.hardware.focus();
}
</script>
</head>
<body>
<form name="main" method='post'>
<table id="tbl1" width="800" border="1" cellspacing="1" cellpadding="2" style="border-collapse:collapse;">
<tbody id="tbl1body">
<tr bgcolor="#94D5FF" align="center">
<td width="30"><b>ID</b></td>
<td width="150"><b>Hardware</b></td>
<td width="150"><b>Brand</b></td>
<td width="150"><b>Price</b></td>
<td width="20"><a href="#" onClick="addRowTo('tbl1body')"><img border=0 src="i_add.gif"></a></td>
</tr>
<tr>
<td><input type='hidden' name='rowid' size=20 maxlength=200 value=""></td>
<td><input type='hidden' name='hardware' size=20 maxlength=200 value=""></td>
<td><input type='hidden' name='brand' size=20 maxlength=200 value=""></td>
<td><input type='hidden' name='price' size=20 maxlength=200 value=""></td>
</tr>
</table>
</form>
<table id="tbl1" width="800" border="1" cellspacing="1" cellpadding="2" style="border-collapse:collapse;">
<tbody id="tbl1body">
<tr bgcolor="#94D5FF" align="center">
<td>
Sum Price :
</td>
</tr>
</table>
</html>
[/HTML]
Please use the code tags from now on - iam_clint
add row is good but remove row not good it remove all row
and i need get sum price value