Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. changing default buttons

changing default buttons

Scheduled Pinned Locked Moved Web Development
data-structurestutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike Hodnick
    wrote on last edited by
    #1

    I have a form with two input text boxes and two buttons. Each button performs a different action, and uses one of the corresponding input text boxes as an input parameter. Example: enter text in box 1, click button 1, get a result. enter text in box 2, click button 2, something else happens. A frequent request of users is "I want to type something in box 1 and just click Enter to perform action 1" or "type something in box 2 and click Enter to perform action 2". How can this be accomplished? I'm assuming there is some DHTML tactics I need to use, but I don't know where to start. - Mike ------------------------- "No human being would stack books like that." - Dr. Venkman

    O 1 Reply Last reply
    0
    • M Mike Hodnick

      I have a form with two input text boxes and two buttons. Each button performs a different action, and uses one of the corresponding input text boxes as an input parameter. Example: enter text in box 1, click button 1, get a result. enter text in box 2, click button 2, something else happens. A frequent request of users is "I want to type something in box 1 and just click Enter to perform action 1" or "type something in box 2 and click Enter to perform action 2". How can this be accomplished? I'm assuming there is some DHTML tactics I need to use, but I don't know where to start. - Mike ------------------------- "No human being would stack books like that." - Dr. Venkman

      O Offline
      O Offline
      OBRon
      wrote on last edited by
      #2

      Assuming you can use client side javascript, one way to do this is to add a handler for the document.onkeyup event. Within your function, check to see if the enter key was hit. If so, look at the contents of text box 1 and if it is not empty, call button 1. Do the same for text box 2. document.onkeyup = MyHandler; function MyHandler() { if (window.event.keyCode == 13) // enter key pressed... { // add your logic here } }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups