I want to make a condition where the var UPS >= CURRENT along with the other conditions I set. i find the problems is when i compare a variable with another variable.
var BASE = document.getElementById("Base").value;
var UPS = document.getElementById("Ups").value;
var CURRENT = document.getElementById("Current").value;
var calc = ((UPS-CURRENT)*10);
var result = parseInt(BASE)+parseInt(calc);
if(!isNaN(result) && BASE>0 && UPS>0 && CURRENT>=0 && UPS>=CURRENT)
{
document.getElementById("answer").innerHTML="Calculated Potential: "+result;
}
else
{
document.getElementById("answer").innerHTML="Input valid numbers";
}
I want it so the calculations won't show if there is negative value and if the CURRENT value is more than the UPS value