1
   

Calculator functionality

 
 
Reply Wed 22 Jan, 2014 07:52 am
I'm a beginner at jscript so go easy. I'm not sure why this isn't working and it's probably something really simple, but here's my code snippet, any help on this would be greatly appreciated.

function calculate()
{

ValA = 0; ValB = 0; ValC = 0; ITCPer = .35
TotA = 0; TotB = 0; TotC = 0;



if (document.getElementById("valA").value > "")
{ ValA = document.getElementById("valA").value };
document.getElementById("val").value = eval(ValA);

if (document.getElementById("valB").value > "")
{ ValB =document.getElementById("valB").value };
document.getElementById("valB").value = eval(ValB);

if (document.getElementById("valC").value > "")
{ ValC = document.getElementById("valC").value };
document.getElementById("valC").value = eval(ValC);

if (document.getElementById("ITCPer").value> "")
{ ITCPer = document.getElementById("ITCPer").value };
document.getElementById("ITCPer").value = eval("ITCPer");


TotA = ValA + ValB + ValC * ITCPer;
document.getElementById("totalA").value = leeAmt(eval(TotA));



Totamt = eval(TotA);

document.getElementById("GrandTotal").value = leeAmt(eval(Totamt));

}

I think it's pretty clear, I want ValA, B, C to add and multiply by ICTPer to give me a grand total. However, it doesn't calculate at all.

Help! (Or direct me to a thread that has addressed this issue, that's good too!) Smile
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 1 • Views: 1,449 • Replies: 0
No top replies

 
 

Related Topics

Clone of Micosoft Office - Question by Advocate
Do You Turn Off Your Computer at Night? - Discussion by Phoenix32890
The "Death" of the Computer Mouse - Discussion by Phoenix32890
Windows 10... - Discussion by Region Philbis
Surface Pro 3: What do you think? - Question by neologist
Windows 8 tips thread - Discussion by Wilso
GOOGLE CHROME - Question by Setanta
.Net and Firefox... - Discussion by gungasnake
Hacking a computer and remote access - Discussion by trying2learn
 
  1. Forums
  2. » Calculator functionality
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.09 seconds on 12/21/2024 at 10:14:22