Please help with calculation

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 25th, 2007, 11:42
New Member
Join Date: Feb 2007
Location: South
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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);
Reply With Quote

Reply

Tags
calculation

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 19:15.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43