dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: text input math?

  1. #1
    Join Date
    Aug 2005
    Posts
    35

    text input math?/to button or not to button?

    hello all,

    i am very new to JSscipt, how would you go about creating a code for two input fields the second being twice the value of the first? (if first=2, then second=4, etc) thanks john

    EDIT

    after typing in one box the other should display either half or double the value (depending on first or second box),,can this be done without a button of some sort?
    Last edited by jwisneski2003; 09-09-2005 at 07:38 AM. Reason: need button

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    <input type="text" onkeyup="document.getElementById('secondfield').value=Number(this.value)*2)">
    <input type="text" id="secondfield">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles