homepage Welcome to WebmasterWorld Guest from 54.166.84.82
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
javascript calculation problem
simple javascript calculation problem
dawlish

10+ Year Member



 
Msg#: 33 posted 4:38 pm on Jan 18, 2002 (gmt 0)

Hi

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.

<FORM>
<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)">
<INPUT TYPE="TEXT" NAME="answer">
</FORM>

 

grnidone



 
Msg#: 33 posted 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.

toadhall

10+ Year Member



 
Msg#: 33 posted 5:55 am on Jan 21, 2002 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved