I'm new to html and javascript. I have created a table in html that seems to dis play correctly. The Javascript however does not appear to run. add rows, delete rows, and math functions will not run.


<!DOCTYPE html>
<title></title>
<body>
<div class="CW-content">
<div id="cw-budget-worksheet">
<div class="cw-freq">
<label class="h2 pull-left">Budget Period:</label>
<select class="form-control" name="period">
<option value="1">1 Month</option>
<option value="2">2 Months</option>
<option value="3">3 Months</option>
<option value="4">4 Months</option>
<option value="5">5 Months</option>
<option value="6">6 Months</option>
<option value="7">7 Months</option>
<option value="8">8 Months</option>
<option value="9">9 Months</option>
<option value="10">10 Months</option>
<option value="11">11 Months</option>
<option value="12">12 Months</option>
</select>
</div>
<p class="cw-download"><input type="submit" name="submit" value="Download"></p>
<div class="table-responsive">
<table border="0" cellspacing="0" cellpadding="0" class="cw-income">
<tbody>
<tr>
<td valign="top" align="left" colspan="4" class="head">Income (take-home)</td>
<td valign="top" align="right" class="head"><span class="cw-budget-add">Add Row</span></td>
</tr>
<tr id="source-0">
<td valign="top" align="left" colspan="2" class="subhead">Expense</td>
<td valign="top" align="center" colspan="2" class="subhead">Amount / Frequency</td>
<td valign="top" align="right" class="subhead">Amount for Budget Period</td>
</tr>
<tr id="Source-1" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Jane's Paycheck">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left"><select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Source-2" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Jane's Paycheck">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left"><select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr class="subtotal">
<td colspan="4" class="cw-subtotal last">Budget Period Total</td>
<td align="right" class="cw-subtotal">$0.00</td>
</tr>
</tbody>
</table>

<table border="0" cellspacing="0" cellpadding="0" class="cw-loans">
<tbody><tr>
<td valign="top" align="left" colspan="4" class="head">Loans / Debt</td>
<td valign="top" align="right" class="head"><span class="cw-budget-add">Add Row</span></td>
</tr>
<tr id="Loans-0">
<td valign="top" align="left" colspan="2" class="subhead">Expense</td>
<td valign="top" align="center" colspan="2" class="subhead">Amount / Frequency</td>
<td valign="top" align="right" class="subhead">Amount for Budget Period</td>
</tr>
<tr id="Loans-1" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Mortgage / Rent">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Loans-2" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Credit Card">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Loans-3" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Home Equity Loan">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Loans-4" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Car Loan">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Loans-5" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Student Loan">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr class="subtotal">
<td colspan="4" class="cw-subtotal last">Budget Period Total</td>
<td align="right" class="cw-subtotal">$0.00</td>
</tr>
</tbody></table>

<table border="0" cellspacing="0" cellpadding="0" class="cw-utilities">
<tbody><tr>
<td valign="top" align="left" colspan="4" class="head">Utilities</td>
<td valign="top" align="right" class="head"><span class="cw-budget-add"> Add Row</span></td>
</tr>
<tr id="Utilities-0">
<td valign="top" align="left" colspan="2" class="subhead">Expense</td>
<td valign="top" align="center" colspan="2" class="subhead">Amount / Frequency</td>
<td valign="top" align="right" class="subhead">Amount for Budget Period</td>
</tr>
<tr id="Utilities-1" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Gas/Oil">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Utilities-2" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Electricity">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left"><select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Utilities-3" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Telephone">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left"><select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Utilities-4" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Water and Sewer">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left"><select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr class="subtotal">
<td colspan="4" class="cw-subtotal last">Budget Period Total</td>
<td align="right" class="cw-subtotal">$0.00</td>
</tr>
</tbody></table>

<table border="0" cellspacing="0" cellpadding="0" class="cw-insurance">
<tbody><tr>
<td valign="top" align="left" colspan="4" class="head">Insurance Premiums</td>
<td valign="top" align="right" class="head"><span class="cw-budget-add">Add Row</span></td>
</tr>
<tr id="Insurance-0">
<td valign="top" align="left" colspan="2" class="subhead">Expense</td>
<td valign="top" align="center" colspan="2" class="subhead">Amount / Frequency</td>
<td valign="top" align="right" class="subhead">Amount for Budget Period</td>
</tr>
<tr id="Insurance-1" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Life">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left"><select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Insurance-2" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Auto">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left"><select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Insurance-3" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Home">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Insurance-4" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Health">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Insurance-5" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Long Term Care">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr class="subtotal">
<td colspan="4" class="cw-subtotal last">Budget Period Total</td>
<td align="right" class="cw-subtotal">$0.00</td>
</tr>
</tbody></table>

<table border="0" cellspacing="0" cellpadding="0" class="cw-savings">
<tbody><tr>
<td valign="top" align="left" colspan="4" class="head">Savings and Investments</td>
<td valign="top" align="right" class="head"><span class="cw-budget-add"> Add Row</span></td>
</tr>
<tr id="Savings-0">
<td valign="top" align="left" colspan="2" class="subhead">Expense</td>
<td valign="top" align="center" colspan="2" class="subhead">Amount / Frequency</td>
<td valign="top" align="right" class="subhead">Amount for Budget Period</td>
</tr>
<tr id="Savings-1" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Emergency Fund">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Savings-2" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="College Savings">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Savings-3" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Retirement (IRA, etc.)">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr class="subtotal">
<td colspan="4" class="cw-subtotal last">Budget Period Total</td>
<td align="right" class="cw-subtotal">$0.00</td>
</tr>
</tbody></table>

<table border="0" cellspacing="0" cellpadding="0" class="cw-misc">
<tbody><tr>
<td valign="top" align="left" colspan="4" class="head">Miscellaneous</td>
<td valign="top" align="right" class="head"><span class="cw-budget-add">+ Add Row</span></td>
</tr>
<tr id="Misc-0">
<td valign="top" align="left" colspan="2" class="subhead">Expense</td>
<td valign="top" align="center" colspan="2" class="subhead">Amount / Frequency</td>
<td valign="top" align="right" class="subhead">Amount for Budget Period</td>
</tr>
<tr id="Misc-1" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Groceries">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Misc-2" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Child Care">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Misc-3" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Vacation">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Misc-4" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Entertainment (movies, dining out, etc.)">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Misc-5" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Clothing">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Misc-6" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Gas (automobile)">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Misc-7" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Commuting (parking, etc.)">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Misc-8" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Charitable Contributions">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr id="Misc-9" class="deletable">
<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif" alt="Delete"></td>
<td valign="top" align="left">
<input class="editable" type="text" maxlength="40" size="35" value="Out-of-Pocket Medical Expenses">
</td>
<td valign="top" align="right">
<input style="text-align:right;" class="entry" type="text" maxlength="12" size="10" value="$0.00">
</td>
<td valign="top" align="left">
<select class="form-control freq" name="frequency">
<option value="260">Daily</option>
<option value="52">Weekly</option>
<option value="26">Bi-Weekly</option>
<option value="24">Twice Monthly</option>
<option value="12" selected="">Monthly</option>
<option value="4">Quarterly</option>
<option value="1">Annually</option>
<option value="1">One Time</option>
</select></td>
<td valign="top" align="right">$0.00</td>
</tr>
<tr class="subtotal">
<td colspan="4" class="cw-subtotal last">Budget Period Total</td>
<td align="right" class="cw-subtotal">$0.00</td>
</tr>
</tbody></table>

<table border="0" cellspacing="0" cellpadding="0" class="cw-results">
<tbody>
<tr>
<td align="left" valign="top">Total Income</td>
<td align="right" valign="top">$0.00</td>
</tr>
<tr style="border-bottom: 1px solid #fff; border-top: 1px solid #fff;">
<td align="left" valign="top">Total Expenses</td>
<td align="right" valign="top">$0.00</td>
</tr>
<tr>
<td align="left" valign="top">Income Minus Expenses</td>
<td align="right" valign="top">$0.00</td>
</tr>
</tbody></table>
<p><input type="submit" name="submit" value="Download" style="margin-right: 10px;">
<input id="clickClear" type="reset" name="clear" value="Clear">
</p><form id="exportform" action="download_csv.php" method="post" target="_blank">
<input type="hidden" id="csvdata" name="exportdata">
</form>
<!--end cw-budget-worksheet -->
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
$("#cw-budget-worksheet").on("click","span.cw-budget-add",(function(){
var index1 = 0;
var id_part = '';
var td1 = '';
var td2 = '';
var td3 = '';
var td4 = '';
var td5 = '';
var select = '';
var last_id = '';
var container_id = '';
container_id = $(this).closest('table').attr('class');
last_id = $('.'+container_id+' tr:last').prev('tr').attr('id'); //tr.deletable:last
id_part = last_id.split('-')[0];
index1 = last_id.split('-')[1];
//alert("This is the id "+id_part);
index1++;
select = '<select class="form-control freq" name="frequency"+index1> <option value="260"> Daily </option> <option value="52">Weekly</option><option value="26">Bi-Weekly</option><option value="24">Twice Monthly</option><option value="12">Monthly</option><option value="4">Quarterly</option><option value="1">Annually</option><option value="1">OneTime</option></select>';
td1 = '<td valign="top" align="left"><img class="cw-delete-row" src="http://www.trainingcheck.com/live/Resources/Buttons/trial/small-delete.gif"/></td>';
td2 = '<td valign="top" align="left"><input class="editable" style="border:0;" type="text" maxlength="40" size="35" value=+id_part+ +index1+/></td>';
td3 = '<td valign="top" align="right"><input style="text-align:right;" class="entry" type="text" maxlength="10" size="10" value="$0.00"/></td>';
td4 = '<td valign="top" align="left">+select+</td>';
td5 = <'td valign="top" align="right">$0.00</td>';
$('<tr id="'+id_part+'-'+index1+'" class="deletable">'+td1+td2+td3+td4+td5+'</tr>').insertAfter("#"+last_id);
}));

$("#cw-budget-worksheet").on("click","img.cw-delete-row",(function(){
container_id = $(this).closest('tr').attr('id');
$("#"+container_id).remove();
var tbl_id = $(this).closest('table').attr('class');
var subtotal = 0;
$('.' +tbl_id+ ' tr.deletable').each(function() {//.not(':last')
subtotal = Math.round(((Math.round(($(this).find("td:last").html().replace(/[^0-9.]/g,"") )*100)/100 )+ subtotal) *100)/100;
});
//alert("subtotal is: "+subtotal);
$('.'+tbl_id+' tr.subtotal td:last').text("$"+subtotal);
}));

$("#cw-budget-worksheet").on("blur","input.editable",(function(){
//$(this).prev("label").hide();
$(this).removeAttr("style");
$(this).attr("style","background:transparent;border:0px;");
}));

$("#cw-budget-worksheet").on("blur","input.entry",(function(){
var trid = $(this).closest('tr').attr('id');
var entry = parseFloat($('#'+trid+' input.entry').val().replace(/[^0-9.]/g,""));
var freq = parseInt($("#"+trid+" select").val());
var total = Math.round((freq*entry)*100)/100;
var period = parseInt($("select[name='period']").val());
total = Math.round(((total * period) / 12)*100)/100 ;
//alert("Select Value is: "+freq+" current tr is: "+trid+" current entry is: "+entry);//+" Entry is = "+entry);
entry = Math.round(entry*100)/100;
$('#'+trid+' input.entry').val("$"+entry);
$('#'+trid+' td:last').text("$"+total);

var tbl_id = $(this).closest('table').attr('class');
var subtotal = 0;
$('.'+tbl_id+' tr.deletable').each(function() {//.not(':last')
subtotal = Math.round(((Math.round(($(this).find("td:last").html().replace(/[^0-9.]/g,"") )*100)/100 )+ subtotal) *100)/100 ;
});
//alert("subtotal is: "+subtotal);
$('.'+tbl_id+' tr.subtotal td:last').text("$"+subtotal);

update_total();

}));

$("#cw-budget-worksheet").on("change","select.freq",(function(){
var freq = parseInt($(this).val());
var trid = $(this).closest('tr').attr('id');
var entry = parseFloat($('#'+trid+' input.entry').val().replace(/[^0-9.]/g,""));
//alert("Select Value is: "+freq+" current tr is: "+trid+" current entry is: "+entry);//+" Entry is = "+entry);
var total = Math.round((freq*entry)*100)/100;
var period = parseInt($("select[name='period']").val());
total = Math.round(((total * period) / 12)*100)/100 ;
$('#'+trid+' td:last').text("$"+total);

var tbl_id = $(this).closest('table').attr('class');
var subtotal = 0;
$('.'+tbl_id+' tr.deletable').each(function() {//.not(':last')
subtotal = Math.round(((Math.round(($(this).find("td:last").html().replace(/[^0-9.]/g,"") )*100)/100 )+ subtotal) *100)/100 ;
});
$('.'+tbl_id+' tr.subtotal td:last').text("$"+subtotal);
update_total();
}));
$("#cw-budget-worksheet").on("change","select[name='period']",(function(){
var period = parseInt($(this).val());
var count = 1;
var income_t = 0;
var expense_t = 0;
var grand_t = 0;
$("#cw-budget-worksheet table").each(function() {
var tbl_id = $(this).attr('class');
var subtotal = 0;
$('.'+tbl_id+' tr.deletable').each(function() {//.not(':last')
var trid = $(this).attr('id');
var freq = parseInt($("#"+trid+" select").val());
var entry = parseFloat($('#'+trid+' input.entry').val().replace(/[^0-9.]/g,""));
var total = Math.round((freq*entry)*100)/100;
total = Math.round(((total * period) / 12)*100)/100 ;
$('#'+trid+' td:last').text("$"+total);

subtotal = Math.round(((Math.round(($(this).find("td:last").html().replace(/[^0-9.]/g,"") )*100)/100 )+ subtotal) *100)/100 ;
});
//alert("subtotal is: "+subtotal);
$('.'+tbl_id+' tr.subtotal td:last').text("$"+subtotal);
if(count == 1){
income_t = subtotal;
}else{
expense_t += subtotal;
}
count++;
});
grand_t = Math.round((income_t - expense_t)*100)/100 ;
$('.cw-results tr:nth-child(1) td:last').text("$"+income_t);
$('.cw-results tr:nth-child(2) td:last').text("$"+expense_t);
$('.cw-results tr:nth-child(3) td:last').text("$"+grand_t);
}));
$("#cw-budget-worksheet").on("click","input[name='submit']",(function(){
var tbl_data = '';//$('#cw-budget-worksheet').html();
var period = $("select[name='period'] option:selected").text();
tbl_data = "Household Budget Worksheet\n\nBudget Period "+period+"\n\n";

$("#cw-budget-worksheet table").each(function() {
//alert("table class "+$(this).attr("class"));
var tbl = $(this).attr("class");
$('tr',this).each(function() {//.not(':last')

//alert("row class "+$(this).attr("class"));
if(tbl == "cw-results"){
$('td',this).each(function() {
tbl_data += $(this).text()+",,,";
});
}else{
if($(this).attr("class") == "deletable"){

//tbl_data += "x,";
var input = $(this).find("input.editable").val().replace(/,/g,"");
tbl_data += input+",";
tbl_data += $(this).find("input.entry").val()+",";
tbl_data += $(this).find(".freq option:selected").text()+",";
tbl_data += $(this).find("td:nth-child(5)").text()+",";
//alert("processing class del.."+data);
}else{
if($(this).attr("class") == "subtotal"){
$('td',this).each(function() {
tbl_data += $(this).text()+",,,";
});
}else{

if($(this).index() === 0){
tbl_data += $(this).find("td:nth-child(1)").text()+",,,,";
//tbl_data += $(this).find("td:nth-child(2)").text()+",";
}else if($(this).index() == 1){
tbl_data += $(this).find("td:nth-child(1)").text()+",";
var column_amt = $.trim($(this).find("td:nth-child(2)").text().split('/')[0]);
var column_freq = $.trim($(this).find("td:nth-child(2)").text().split('/')[1]);
tbl_data += column_amt+",";
tbl_data += column_freq+",";
tbl_data += $(this).find("td:nth-child(3)").text()+"\n";
}
}
}
}

tbl_data += "\n";
});
tbl_data += "\n\n";
});

$("#csvdata").val(tbl_data);
$("#exportform").submit();

//window.open('data:application/vnd.ms-excel,' + $('#cw-budget-worksheet').html());
// window.open('data:application/vnd.ms-excel,' + encodeURIComponent(('#cw-budget-worksheet').html()));

}));
$("#cw-budget-worksheet").on("click","#clickClear",(function(){
$("#cw-budget-worksheet table").each(function() {
var tbl_id = $(this).attr('class');
$('.'+tbl_id+' tr.deletable').each(function() {
var trid = $(this).attr('id');
$('#'+trid+' input.entry').val("$0.00");
$('#'+trid+' td:last').text("$0.00");
$("#"+trid+" select").val(12);
});
//alert("subtotal is: "+subtotal);
$('.'+tbl_id+' tr.subtotal td:last').text("$0.00");
});
$('.cw-results tr:nth-child(1) td:last').text("$0.00");
$('.cw-results tr:nth-child(2) td:last').text("$0.00");
$('.cw-results tr:nth-child(3) td:last').text("$0.00");
}));

function update_total(){
var count = 1;
var income_t = 0;
var expense_t = 0;
var grand_t = 0;
$("#cw-budget-worksheet table").each(function() {
var tbl_id = $(this).attr('class');
if(tbl_id != "cw-results"){
var total_sub = 0;
total_sub = parseFloat($('.'+tbl_id+' tr.subtotal td:last').html().replace(/[^0-9.]/g,""));

if(count == 1){
income_t = total_sub;

}else{
expense_t += total_sub;

}
count++;
}
});
grand_t = Math.round((income_t - expense_t)*100)/100 ;
if(grand_t < 0){
$('.cw-results tr:nth-child(3) td:last').attr("style","color: red;");
}
$('.cw-results tr:nth-child(1) td:last').text("$"+income_t);
$('.cw-results tr:nth-child(2) td:last').text("$"+expense_t);

$('.cw-results tr:nth-child(3) td:last').text("$"+grand_t);
}
});
</script>
</body>


Thanks for the help