EriX Posted April 12, 2011 Share Posted April 12, 2011 Hello, I got problem, with JavaScript i really don't work,but now i need some script. So, i need to calculate 3 different values. Weight - size - Total Cost I use 2 different function to calculate theses values, but now i don't understand how i need to calculate last value - Total cost. Formula is: if((info_from_mysql < weight) or info_from_mysql < size) { Total Cost = Info_from_mysql_table; } So maybe someone has any mind how to do it? By the way i use this function to calculate weight and size: function UpdateWeight() { var sum = 0; var gn, elem; for (i=0; i<7; i++) { gn = 'order'+i; elem = document.getElementById(gn); if (elem.checked == true) { sum += Number(elem.value); } } document.getElementById('weight').value = sum.toFixed(2); } Thanks for help. Quote Link to comment https://forums.phpfreaks.com/topic/233503-javascript-calculator/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.