Login | Register | FAQ
Anonymous

Preforming basic maths functions

+ Post a reply

21 posts 1, 2, 3


Preforming basic maths functions

by nicci5 » Tue Jul 17, 2012 9:56 am

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 !!
User avatar

nicci5

  • Posts: 12
  • Joined: Tue Jul 17, 2012 9:51 am

Re: Preforming basic maths functions

by nicci5 » Tue Jul 17, 2012 10:35 am

small update this is what i have so far
var result=0;
var secondnumber=("1 PERSON CELLCYCLE TIME");
var firstnumber=3600;
result=firstnumber/secondnumber;
User avatar

nicci5

  • Posts: 12
  • Joined: Tue Jul 17, 2012 9:51 am

Re: Preforming basic maths functions

by atik » Tue Jul 17, 2012 11:24 am

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?
User avatar

atik

  • Posts: 471
  • Joined: Mon Oct 17, 2011 4:55 pm

Re: Preforming basic maths functions

by nicci5 » Tue Jul 17, 2012 12:11 pm

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 !!!!!
User avatar

nicci5

  • Posts: 12
  • Joined: Tue Jul 17, 2012 9:51 am

Re: Preforming basic maths functions

by atik » Tue Jul 17, 2012 12:36 pm

User avatar

atik

  • Posts: 471
  • Joined: Mon Oct 17, 2011 4:55 pm

Re: Preforming basic maths functions

by nicci5 » Thu Jul 19, 2012 12:27 pm

hi

thanks 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
User avatar

nicci5

  • Posts: 12
  • Joined: Tue Jul 17, 2012 9:51 am

Re: Preforming basic maths functions

by atik » Thu Jul 19, 2012 12:33 pm

User avatar

atik

  • Posts: 471
  • Joined: Mon Oct 17, 2011 4:55 pm

Re: Preforming basic maths functions

by nicci5 » Thu Jul 19, 2012 12:54 pm

hi i copied and pasted your script so not sure what could of gone wrong ?
User avatar

nicci5

  • Posts: 12
  • Joined: Tue Jul 17, 2012 9:51 am

Re: Preforming basic maths functions

by atik » Thu Jul 19, 2012 12:58 pm

User avatar

atik

  • Posts: 471
  • Joined: Mon Oct 17, 2011 4:55 pm

Re: Preforming basic maths functions

by nicci5 » Thu Jul 19, 2012 1:01 pm

hi

i 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
User avatar

nicci5

  • Posts: 12
  • Joined: Tue Jul 17, 2012 9:51 am


+ Post a reply

1, 2, 3