This is a discussion on "Please help with calculation" within the JavaScript Forum section. This forum, and the thread "Please help with calculation are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Please help with calculation
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Please help with calculation
I'm very new with javascript so I need help with what I think should be a very simple calculation. Here's what I'm trying to do:
Webpage contents: drop down menu (S2) with set values for each item drop down menu (S3) with set values for each item form field (T1) for user input of number push button (B3) to perform calculation form field (T5) for calculation result When the user selects items from S2 and S3 and puts a number in T1 then clicks B3 the result should show in T5. This does not work correctly, the problem seems to be when I try to add 6 to y, because it gives me the correct answer with just y. function ratings() { var t=document.cMount.S2.value; var y=document.cMount.T1.value; if (document.cMount.S3.value==12){ var Lmax=((2*t)*(146700/3))/y;} if (document.cMount.S3.value==25){ var Lmax=((2*t)*(146700/3))/(y+6);} if (document.cMount.S3.value==64){ var Lmax=((2*t)*(146700/3))/(y+6);} document.cMount.T5.value=Lmax.toFixed(0); |
|
|
![]() |
| Tags |
| calculation |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| total days calculation | melisa | JavaScript Forum | 0 | May 25th, 2007 01:17 |
| JS option value calculation / validation | stroodle01 | JavaScript Forum | 0 | Mar 15th, 2007 18:32 |
| Arithmetic Calculation | Monie | Databases | 0 | Oct 18th, 2006 11:01 |
| Age Calculation | ekendricks | JavaScript Forum | 4 | May 10th, 2006 10:56 |
| 24 hour time calculation | kinjiro | JavaScript Forum | 9 | Sep 20th, 2003 06:40 |