plzz help!!!!


i am struck wit one of my task.... in html/jscripts .. i have to design a page which dynamically generates a table and inserts the values submited.... in which i have 3 radio buttons ... which should toggle the visibility of the table..

Requirement:

-design a page to keep the track of payments
-select box which holds two types (payments /adjustments)
-data when submitted to be saved in the table
-by default "all" radio box to be checked
if payment radion button is checked the fields of nly payments to be displayed
if adjustments radion button is checked the fields of nly adjustments to be displayed
-



this the code i developed soo far


[CODE]

<html>
<head>
<title> Payments/Adjustments
</title>
<script>



var num1=0;
function Output(srcHolder)
{
alert("haiiii");
//var srcTable = document.createElement("resultTable");

srcTable = document.getElementById("resultTable");
srcTable.deleteRow(srcTable.rows.length-1);
tmpRow = srcTable.insertRow();

tmpCell = tmpRow.insertCell();
tmpCell.innerText = f.date.value;

tmpCell = tmpRow.insertCell();
tmpCell.innerText = f.type.value+"-"+f.name.value;


tmpCell = tmpRow.insertCell();
tmpCell.innerText = f.amount.value;
num1=f.amount.value;
var total=add();



tmpRow = srcTable.insertRow();
tmpCell = tmpRow.insertCell();
tmpCell.innerText = "amount";
tmpCell = tmpRow.insertCell();
tmpCell.innerText = total;

srcHolder.appendChild(srcTable);

if(flag==1)
{
tmpRow = srcTable.insertRow();
tmpCell = tmpRow.insertCell();
tmpCell.innerText = f.date.value;
}

}
var sum=0;
function add()
{
num1=parseInt(num1);
sum=sum+num1;
return sum;
}

</script>




</head>


<body>
<form name="f">
<table align="center">
<tr>
<td>
DATE:<input type="name" id="date" title="enter date in mm/dd/yyyy format" size="20" maxlength="10"/>
</td>
<td>
For:<input type="name" id="name" title="Entername" size="40" />
</td>
<td>
Amount:<input type="name" id="amount" title="amount" size="10" />
</td>
</tr>
<tr>
<td colspan="3">
Type:<select name="type">
<option value="">--Select--</option>
<option value="adjust" >adjustments</option>
<option value="payments">payments</option>
</select>
<td>
</tr>
</table>
<br><center>
<input type="button" name="Save" value="Save" onclick="Output(srcHolder)"/>
<input type="reset" name="Cancel" value="Cancel"/>
</center>
<hr>

<center>
<label for="type">Type</label>
<input type="radio" name="type1" value="pa"/>payments

<input type="radio" name="type1" value="ad"/>adjustments

<input type="radio" name="type1" value="all" />all

<table border="3" id="resultTable">
<thead>

<th>Date
</th>

<th>For
</th>
<th>Amount
</th>

</thead>




<tbody>

<tr>
</tr>

<tr>
</tr>
<th>
</tr>


</tbody>


</table>
<div id="srcHolder" >

</div>
</form>
</body>
</html>

[CODE]