Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript newbie: Firefox OnChange Problem

Status
Not open for further replies.

supergrover1981

Programmer
Sep 25, 2006
1
AU
Gidday Gang,

I'm currently trying to make a simple price calculator for a web page. It works like this:

- A visitor enters a quantity of each product they desire in a text input box

- A read-only input box then displays the subtotal for that item(trigged by ONCHANGE of the quantity text box)

- A read-only input box displays the total for all items (triggered by the ONCHANGE of the quantity text box)


The calculator works fine in Internet Explorer, but the subtotal/total boxes don't display anything at all in Firefox. Page can be seen at
If anyone has any suggestions at all for this problem, I'd be most appreciative.

Cheers gang,
- JB
 
It's working fine for me in Firefox 1.5.0.7 as soon as I click somewhere besides the textbox I just changed the quantity in. You might try using onblur so you get consistent results between browsers, and the amounts only update after someone is finished typing a quantity in the text input.

You also need to do some error checking to make sure the user has entered only an integer. I used a letter just to test, and your form had $NaN for the individual item total as well as the final total.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top