
October 26th, 2005, 08:44 AM
|
|
Contributing User
|
|
Join Date: Apr 2007
Location: The Netherlands
Posts: 9
Time spent in forums: 1 h 51 m 40 sec
Reputation Power: 0
|
|
|
Have two text fields react to each other
Hi there,
I'm building a stock market game, where children can buy and sell shares in virtual companies.
At some point I want them to be able to buy shares, obviously. On the buy page there should be two textfields, A and B.
The children can now decide to type in the NUMBER of shares they want to buy in textfield A. When they press Tab or Enter, textfield B should automatically update to the amount of dollars they should pay for it (number of shares * value of 1 share).
But they should also be able to type in the amount of dollars they want to spend in textfield B, which would automatically update textfield A to the number of shares they'd get for that amount of money.
Can this be done using PHP? (I guess not, but I thought I should ask). Should this be done in JavaScript and if so, how? (Complete Javascript newbie)...
|