Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


javascript syntax

  • Please log in to reply
No replies to this topic

#1 12Strings


  • Members
  • 41 posts
  • Local time:11:55 PM

Posted 15 August 2014 - 07:06 PM

Hi, no doubt, the following should be - is a simple little project.
Please, someone tell me why it doesn't work. submitting the acct#, entering
the  paidamt enters the date. Only those two fields are updated.
Below is the relevant code. thanks.

function $_(IDS) { return document.getElementById(IDS); }function 
calculate_paid() {   var paidamt = 
document.getElementById("paidamt");     var amtdue = 
document.getElementById("amtdue");   var prevbal = 
document.getElementById("prevbal");     var status = 
var pd = document.getElementById("pd");   var checkno = 
document.getElementById("checkno"); var datepaid = 
document.getElementById("datepaid");      var 
dateNow = new Date();  var dayNow = dateNow.getDate();  var 
paydate = 
= paydate;  amtdue.value = parsefloat(amtdue.value)paidamt.value = 
parsefloat(paidamt.value)prevbal.value = parsefloat(prevbal.value)  
checkno.value = parseint(checkno.value)checkno = checkno + 
1;    if(status=="N") {amtdue = amtdue + prevbal - 
paidamt;}   if(status=="Y") {prevbal = prevbal + amtdue - 
     if(amtdue==0.00) { pd = "P"; }    
if(prevbal==0.00) { pd = "P"; }   } 
<script type="text/javascript" src="paytest.js"></script>
       <td><input type='text' size=7 
id='paidamt' name='paidamt' value='" . $row['paidamt'] 
type='text' size=7 id='amtdue' name='amtdue' value='" . $row['amtdue'] . 
"'></td><td><input type='text' size=7 id='prevbal' 
name='prevbal' value='" . $row['prevbal'] . 
"'></td><td><input type='text' size=10 id='datepaid' 
name='datepaid' value='" . $row['datepaid'] . 
"'></td><td><input type='text' size=1 id='pd' name='pd' 
value='" . $row['pd'] . "' ></td> <td><input 
type='text' size=5 id='checkno' name='checkno' value='" . $row['checkno'] . "'

Edited by 12Strings, 15 August 2014 - 07:07 PM.

BC AdBot (Login to Remove)


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users