# Preforming basic maths functions

## Preforming basic maths functions

hi i am trying to set a form so that it preforms basic maths functions when certain boxes are filled.Time Boxes 1-4 are filled in by the user in seconds ie 100,500,600,400

Box a adds the time boxes up which i have dome using value is box.

now the bit i really cant do !!!

box b needs to divide 3600 by the total of box a (which can vary)

Box c needs to divide 2700 by the total of box a

box d needs to divide 25200 by the total of box a

not sure if that makes any sense i am a total novice !!

## Re: Preforming basic maths functions

small update this is what i have so farvar result=0;

var secondnumber=("1 PERSON CELLCYCLE TIME");

var firstnumber=3600;

result=firstnumber/secondnumber;

## Re: Preforming basic maths functions

Not sure i have understood fully, but here is what i understood- there are four boxes for time input (box 1 - 4) and four other boxes ( box a - d). Box a is sum of box 1-4 and you are able to get this value. If thats the case , then you already have the value of box 1- 4 added and put the value in a variable. Now box b needs to divide 3600 by the total of box a. Since you already have the value of a in the previous step by adding those 4 boxes (1-4) and as i told you to store the total value in a variable, then for box b, all you need to divide 3600 by the variable holding the value of box a. Then in which step you are failing?## Re: Preforming basic maths functions

Boxes 1-4 will be filled in by another user , so the total in box a will always be different i wont have the total at the time i want to set up a template form so that it always does the calculation when they enter the seconds for each task.if i had the total i could use 3600/1300 etc but i dont have the total but have the number i need the total to divide by

3600/total of box a

2700/total of box a

25200/total of box a

i think i may be over thinking it but this is the first time i have been asked to do this and i really dont want to look as stupid as i feel to my boss !!!!!

## Re: Preforming basic maths functions

## Re: Preforming basic maths functions

hithanks for the help , when i have entered the script it come up with an error ? var n2 = document.getElementById("TIME_2").value;

Syntax error 3:at line 4

also excuse me for being very dim but does all the script go in one text box or does it split to enable each box to work ?

thanks again

nicci

## Re: Preforming basic maths functions

## Re: Preforming basic maths functions

hi i copied and pasted your script so not sure what could of gone wrong ?## Re: Preforming basic maths functions

## Re: Preforming basic maths functions

hii changed the names in some places as i thought they would have to be called what they ate in the form ie your number 1 field is called TIME on my form , if i change the names on my form to match yours do you think that would work ?

Nicci