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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Default action

Default action

Scheduled Pinned Locked Moved ASP.NET
sysadminquestiondiscussion
2 Posts 2 Posters 2 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.
  • N Offline
    N Offline
    Not Active
    wrote on last edited by
    #1

    I would like to have a form accept the enter key asthe default action. I have a button that submits the form and it works fine. I can trap the keypress event and call the click method on the button but this causes the page to repost to the server where as clicking on the actual button does not. Anyone have thoughts on this?

    R 1 Reply Last reply
    0
    • N Not Active

      I would like to have a form accept the enter key asthe default action. I have a button that submits the form and it works fine. I can trap the keypress event and call the click method on the button but this causes the page to repost to the server where as clicking on the actual button does not. Anyone have thoughts on this?

      R Offline
      R Offline
      Rob Koval
      wrote on last edited by
      #2

      If your target browser is IE you could do something like this: function MyKeyHandler() { if(correctKeyPressed) { var btn = document.getElementById("myBtn"); btn.click(); //Simulates a click by causing the onclick event to fire. } }

      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