I took a working program and modified it to use different values and can't seem to make it work now. I want have the datepaid, pd & paidsum insert when I key in the amtpaid .

HTML Code:
<html><head>
<!--when the paidamt is keyed in, the current date, pd & paidsum are autoinserted-->
<script>
function $_(IDS) { return document.getElementById(IDS); }
function calculate_paid() {
   var invnum = document.getElementById("invnum");
   var ordernum = document.getElementById("ordernum");
   var bname = document.getElementById("bname");
   var charges = document.getElementById("charges");
   var paidamt = document.getElementById("paidamt");
   var tax = document.getElementById("tax");
   var datepaid = document.getElementById("datepaid");
   var pd = document.getElementById("pd");
   var paidsum = document.getElementById("paidsum");
<!--********************set up date**********************-->
  var dateNow = new Date();
  var dayNow = dateNow.getDate();
  var datePaid = (dateNow.getMonth()+1)+"/"+dateNow.getDate()+"/"+dateNow.getFullYear();
datepaid.value = datePaid;
<!--end date setup-->
<!--accumulate charges into paidsum, calculate tax, set up pd & calculate dayslate (?)--> 
charges.value = parseFloat(charges.value);
paidsum.value = parseFloat(paidsum.value) + parseFloat(paidamt.value);
tax.value= parseFloat(charges.value) * .06;
pd.value = "P";
<!--********************* end of calcs ******************-->
</script>
<script type="text/javascript">
window.google_analytics_uacct = "UA-256751-2";
</script>
<script type="text/javascript">
window.google_analytics_uacct = "UA-256751-2";
</script>
</head><body><form method="post" action="#">
<br />
<input type="text" name="invnum"/> <p>
<input type="submit" name="submit" value="select inv#"/>
</form>
<script type="text/javascript"><!--
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
//-->
</script>
<script type="text/javascript"><!--
try {
var pageTracker = _gat._getTracker("UA-256751-2");
pageTracker._trackPageview();
} catch(err) {}
//-->
</script>
<script type="text/javascript"><!--
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
//-->
</script>
<script type="text/javascript"><!--
try {
var pageTracker = _gat._getTracker("UA-256751-2");
pageTracker._trackPageview();
} catch(err) {}
//-->
</script>
</body></html>