View Full Version : Add row works in ie not firefox

Apr 13th, 2010, 04:12 PM
I have a form that is working fine in IE, submits fine in Firefox but will not add additional rows.
Please keep in mind that I have pieced my form together with a series of copy/paste actions and a little manipulation as I have no training or knowlegde in html/javascript.
Any help will be greatly appreciated. Thank you! Thank you!

<SCRIPT type=text/javascript>
var inputCount = 0;
function addLine() {
var objSource = window.event.srcElement;
var currentTR, currentTD, currentSelect, temp;

//set row number

//here we will delete the line
while ( (objSource = objSource.parentElement) && objSource.tagName !="TBODY");

//add the tr to the table
currentTR = objSource.insertRow();
currentTR.bgColor = "C9C9C9";
currentTD = currentTR.insertCell();
currentTD.innerHTML = "<input type='text' size='16' name='ISBN_"+inputCount+"'>";
currentTD = currentTR.insertCell();
currentTD.innerHTML = "<input type='text' size='15' name='AUTHOR_"+inputCount+"'>";
currentTD = currentTR.insertCell();
currentTD.innerHTML = "<input type='text' size='30' name='TITLE_"+inputCount+"'>";
currentTD = currentTR.insertCell();
currentTD.innerHTML = "<input type='text' size='3' name='QTY_"+inputCount+"'>";
currentTD = currentTR.insertCell();

currentTD.innerHTML = "<input type='Button' class='Button' onclick='removeLine()' value='Delete this line'>";

function removeLine() {
var current = window.event.srcElement;

//here we will delete the line
while ( (current = current.parentElement) && current.tagName !="TR");


<TABLE id=myTable cellSpacing=1 cellPadding=3 bgColor=#ffffff border=0>
<TR vAlign=top bgColor=#c9c9c9>
<TH><INPUT class=Button onclick=addLine() type=button value="add a row"><BR></TH></TR>
<TR vAlign=top bgColor=#c9c9c9>
<TD><INPUT size=16 name=ISBN><BR></TD>
<TD><INPUT size=15 name=AUTHOR> </TD>
<TD><INPUT size=30 name=TITLE> </TD>
<TD><INPUT size=3 name=QTY> </TD>
<TD><INPUT class=Button onclick=removeLine() type=button value="Delete this line"><BR>