Results 1 to 3 of 3

Thread: Using Buttons..

  1. #1
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Using Buttons..

    I would like to use a button to add info to a form field. The button would have the info contain within. It would be more like an option.

    This is what I mean: I want to have several buttons on my page that are contected to a single form text field. The info that shows in the form field will come from clicking one of the buttons.

    How would I go about doing this?

  2. #2
    Join Date
    Jul 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Does anyone have an idea for me?

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You need to use Javascript:
    Code:
    <form action="">
      <div>
        <input type="text" name="textfield">
        <input type="button" onclick="this.form.elements.textfield.value = this.value;" value="First Value">
        <input type="button" onclick="this.form.elements.textfield.value = this.value;" value="Second Value">
        <input type="button" onclick="this.form.elements.textfield.value = this.value;" value="Third Value">
      </div>
    </form>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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