Have the following two functions - first one adds max of 3 rows to a table - one row added each time user clicks button:
The next function allows a user to remove the last added row:
How can I change the removeRow() function so that a user can remove each added row - one at a time?
Thanks, John
Code:
<script type="text/javascript">
var showing = 0;
function showAnother()
{
if ( showing <= 3 )
{
++showing;
document.getElementById("row"+showing).style.display ="";
}
if ( showing > 3)
{
alert("You have added the maximum number of rows available.");
}
}
</script>
The next function allows a user to remove the last added row:
Code:
<script type="text/javascript">
function removeRow()
{
if ( showing >= 0 )
{
showing--;
document.getElementById("row"+showing).style.display ="none";
}
if ( showing = 0 )
{
alert("You have removed all of the added rows.");
}
}
</script>
How can I change the removeRow() function so that a user can remove each added row - one at a time?
Thanks, John