Expand|Select|Wrap|Line Numbers
- function calct()
- {
- var un1=document.getElementById("unit").value;
- var qn1=document.getElementById("qty").value;
- var x1=eval(un1);
- var y1=eval(qn1);
- var z1=eval(x1*y1);
- document.getElementById("subtl").value= z1;
- }
I think its wrong because it gives me NaN as the value for my text box subtl
And i dont know how to generalize a function. I have multiple variable "unit" (unit1, unit2, unit3... ), "qty" (qty1, qty2, qty3...) and aslo 'subtl" so I was wondering if there is a way to use 1 function for all of them?