/    Sign up×
Community /Pin to ProfileBookmark

Calculations within a form

Good day,

Being new to javascript I have run into a problem with a form I’m creating. Basically I want to take input from one textbox(number1) perform a calculation then display it in another textbox(number2). Also, based on that value (number2), I want a textbox (number3) to display a different value.

Here is the form I’m working on. The input from the Numbers textbox(number1) is calculated then displayed in the Hours textbox(number2). Then based on that number in the Hours text box it goes down to the Estimate textbox(number3).

Any help, code, example whould be much apprecaited. I have been stuck on this for awhile.

Thank you.

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@96turnerriMar 30.2004 — you need to refernece these three textboxes

var a = document.form.textboxonename.value;

var b = document.form.textboxtwoname.value;

var c = document.form.textboxthreename.value;

b = a * 2;

c = b - 2;

something like that would be the function your are after

Rich
Copy linkTweet thisAlerts:
@delmicm75authorMar 30.2004 — thank you Rich,

I think that is the logic I'll need for this form.
Copy linkTweet thisAlerts:
@96turnerriMar 30.2004 — i wasnt sure what calculations you were using so used simple ones if you have a problem implementing more complex calculations, pm me or post back here.
Copy linkTweet thisAlerts:
@fredmvMar 30.2004 — Welcome to the forums.

If you need further help on this please don't hesitate to ask.
Copy linkTweet thisAlerts:
@96turnerriMar 30.2004 — stop spamming fredmv, no seriously welcome to the forums, forgot to say that
Copy linkTweet thisAlerts:
@fredmvMar 30.2004 — [i]Originally posted by 96turnerri [/i]

[B]stop spamming fredmv[/B][/QUOTE]
I'll take it you're just kidding, though remember that sarcasm doesn't go very well through text. I was merely welcoming the new user to the forums and ensuring them that we could help them further if need be, primarily because you haven't really provided them with enough detail.
Copy linkTweet thisAlerts:
@steelersfan88Mar 30.2004 — and also since the OP stated he was a beginner, he/she may not know how to return a value, especially as it is stoed in a variable (these are not by value subs ?). I find it necessary to explain the whole process if asked, and therefore feel the fred did thje right thing in welcoming the user and making him feel hospitable ?
Copy linkTweet thisAlerts:
@96turnerriMar 30.2004 — yes i was joking, well i only gave them that as firstly i am at work so cant do to much posting, if they didnt understand it then i would of given complete code or helped more, but from there reply it appears they know what they are talking about ?
×

Success!

Help @delmicm75 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...