Hello to all and thanks for your help in advance.
I am having been fighting with this problem for a couple of days now and after much unsuccessful research, I am still looking for an answer. So here it is. I have 9 hidden fields(qty12,24 ,36,72,144,288, 576,1008,2016) on a form containing recordsets pulled from a mySQL database. The values from the database are there... (now we get to the problem.) I have a text box called quantity where a user inputs how many of a particular product they desire. if the user enters a number less than or equal to 12 it has to be multiplied by qty12 if its 13-24 it must use recordset qty24, if its between 25-36 it must use qty36 and so on all the way out to 2016. This is what I have written so far any help would be greatly appreciated.
The alert is only there so that I could make sure that everything worked. it will be removed and the value will be placed in a text box.
I am sure that there is a much easier way to do, any suggestions or places to go for research would be great! Again thank you all.
I am having been fighting with this problem for a couple of days now and after much unsuccessful research, I am still looking for an answer. So here it is. I have 9 hidden fields(qty12,24 ,36,72,144,288, 576,1008,2016) on a form containing recordsets pulled from a mySQL database. The values from the database are there... (now we get to the problem.) I have a text box called quantity where a user inputs how many of a particular product they desire. if the user enters a number less than or equal to 12 it has to be multiplied by qty12 if its 13-24 it must use recordset qty24, if its between 25-36 it must use qty36 and so on all the way out to 2016. This is what I have written so far any help would be greatly appreciated.
Code:
function getCalc(){ var f = document.prodform.quantity.value; var g = document.prodform.qty12.value; var h = document.prodform.qty24.value; var j = document.prodform.qty36.value; var k = document.prodform.qty72.value; var l = document.prodform.qty144.value; var m = document.prodform.qty288.value; var n = document.prodform.qty576.value; var o = document.prodform.qty1008.value; var p = document.prodform.qty2016.value; if(f >= 12){ Number(f * g); }else if (f < 24){ Number(f * h); }else if (f < 36){ Number(f * j); }else if(f < 72){ Number(f * k); }else if(f < 144){ Number(f * l); }else if(f < 288){ Number(f * m); }else if(f < 576){ Number(f * n); }else if(f < 1008){ Number(f * o); }else if(f < 2016){ Number(f * p); } } alert (document.prodform.price.value);
I am sure that there is a much easier way to do, any suggestions or places to go for research would be great! Again thank you all.
Comment