Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

javascript calculation problem

simple javascript calculation problem



4:38 pm on Jan 18, 2002 (gmt 0)

10+ Year Member


I'm very new to scripting and essentially I want to have a form that does a simple calculation based on the value entered in a text field times but the value selected in a radio. I want it to dynamically update the value in the second text field when the radio button is selected without having to click a button. I've tried the following but it doesn't work. Any advice most welcome.

<INPUT TYPE="TEXT" NAME="number1"> x 2<INPUT TYPE="radio" NAME="number2" value="2" onClick="this.form.answer.value = (this.form.number1.value - 0) * (this.form.number2.value - 0)">
3<INPUT TYPE="radio" NAME="number2" value="3" onClick="this.form.answer.value = (this.form.number1.value - 0) * (this.form.number3.value - 0)">


6:57 pm on Jan 20, 2002 (gmt 0)

Welcome Dawlish! My javascript scripting ability has remained consistant over the years: it still sucks. I'll see if I can't round up someone to help you.


5:55 am on Jan 21, 2002 (gmt 0)

10+ Year Member

Hi dawlish,
Change the name in the second radio button to "number3" and it will work.

Featured Threads

Hot Threads This Week

Hot Threads This Month