JavaScript ?

Results 1 to 2 of 2

Thread: JavaScript ?

  1. #1
    Join Date
    Dec 1969

    Default JavaScript ?

    I have been trying to get the result of a subtraction function, but it keeps returning NaN<BR><BR>My function accepts 2 params (num1,num2)<BR> I do the subtraction<BR> var diff = num1 - num2;<BR><BR>I call the function like this:<BR> subtract(document.form.num1.value, m2.value)<BR><BR>I have also tried to parseInt and parseFloat, but still get the error. <BR><BR>If anyone has had this problem before, please steer me in the right direction. I would greatly appreciate it<BR><BR>thanks,<BR>mj

  2. #2
    Ed Guest

    Default RE: JavaScript ?

    Try:<BR><BR>var diff = parseInt(num1) - parseInt(num2)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts