View Full Version : make javascript calculate?

Dec 23rd, 2006, 09:14 PM
i have a form with a quantity and price text input in a form can i make it calulate the cost in a form text input called toal cost

Dec 23rd, 2006, 09:17 PM

What are you wanting us to do? Don't ask questions that can have a yes or no answer. We aren't just going to write the code for you either. What exactly have you done? Have you tried doing this yourself? I'll give you a hint, you will need to use either Number(), parseInt() or parseFloat() on the input from the form in order to calculate it.

Dec 23rd, 2006, 09:32 PM
i have created the form and set the input type maxlenth size and gave each input a name, i just need the code that calcualtes it i am a begginer in javascript and only know varabiles

Dec 24th, 2006, 05:45 AM
So again what have you tried? We aren't here to just give you code especially since you haven't shown us what you have tried to let us know that you even are trying.

Dec 24th, 2006, 08:06 AM
as i said i am a begginer i tryed the below:
i have got a text form named quantity and cost
so i tryed <script type="text/javascript>var cost*quantity i know nothing about javascript i have only just finshed learning html so your help is much appreacited

Dec 24th, 2006, 08:17 AM
Do some searching next time: http://www.irt.org/script/1003.htm

That was in the first search I did on google
"How to multiply form inputs?"

Dec 24th, 2006, 11:23 AM
can anyone help me as the website above code dosen't work and i want it to calculate say i have 1 in one input and the .00 in thge other so it is 1.00 and then times that by the quantity all help i wil be gratefull for i have done the form i just need the piece if code or a link to a site