Want to fill a form box2 automatically based on form box1 input [on the same page]

Discussion in 'Javascript' started by Matt MC, May 19, 2005.

  1. Matt MC

    Matt MC Guest

    How would I put this together so,

    <input name="input1" type="text">

    <input name="input2" value="whatever is typed into input1" type="text">

    I would like to be able to type something in input1, and see it type
    into input2
     
    Matt MC, May 19, 2005
    #1
    1. Advertising

  2. Matt MC

    RobB Guest

    Matt MC wrote:
    > How would I put this together so,
    >
    > <input name="input1" type="text">
    >
    > <input name="input2" value="whatever is typed into input1"

    type="text">
    >
    > I would like to be able to type something in input1, and see it type
    > into input2


    Assuming the same form....

    <input
    type="text"
    name="input1"
    value=""
    onkeyup="this.form.input2.value=this.value">
    <input
    type="text"
    name="input2"
    value=""
    readonly="readonly">
     
    RobB, May 19, 2005
    #2
    1. Advertising

  3. Matt MC wrote:

    > How would I put this together so,
    >
    > <input name="input1" type="text">
    >
    > <input name="input2" value="whatever is typed into input1" type="text">
    >
    > I would like to be able to type something in input1, and see it type
    > into input2


    <input name="input1"
    onkeyup="this.form.elements['input2'].value = this.value;"
    onmouseup="this.onkeyup(event);">
    <input name="input2" value="whatever is typed into input1">

    You don't need to specify type="text", that's the initial value of the
    attribute.


    PointedEars
     
    Thomas 'PointedEars' Lahn, May 25, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt MC
    Replies:
    2
    Views:
    514
    Thomas 'PointedEars' Lahn
    May 25, 2005
  2. John Devlon
    Replies:
    1
    Views:
    964
    Alexey Smirnov
    Sep 24, 2009
  3. Replies:
    4
    Views:
    168
    Martin Walke
    Sep 30, 2005
  4. reneeccwest
    Replies:
    2
    Views:
    129
    reneeccwest
    Jul 12, 2003
  5. Alexandre Jaquet

    options[box1.selectedIndex].value trouble

    Alexandre Jaquet, Aug 30, 2005, in forum: Javascript
    Replies:
    2
    Views:
    106
    Alexandre Jaquet
    Aug 31, 2005
Loading...

Share This Page