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. ASP.NET
  4. KeyPress event of HTML page

KeyPress event of HTML page

Scheduled Pinned Locked Moved ASP.NET
htmlhelp
4 Posts 4 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.
  • N Offline
    N Offline
    nps_ltv
    wrote on last edited by
    #1

    I have a HTML page with a Input tag, I want to capture KeyPress event to get code of the pressed key ( ex : alphabe key, numberic key, ...). I'm in dark. Please help me, thanks.

    A S 2 Replies Last reply
    0
    • N nps_ltv

      I have a HTML page with a Input tag, I want to capture KeyPress event to get code of the pressed key ( ex : alphabe key, numberic key, ...). I'm in dark. Please help me, thanks.

      A Offline
      A Offline
      Atul Kharecha
      wrote on last edited by
      #2

      Hi, I just solved problem like yours. Try following function keydown() { if(window.event.keyCode==13) { //logic of key pressed - it returns ascii code // this will run everytime when any key is pressed on a webform. } } ... .. ... Hope this will solve your problem. Atul. -- modified at 1:56 Friday 7th October, 2005

      V 1 Reply Last reply
      0
      • N nps_ltv

        I have a HTML page with a Input tag, I want to capture KeyPress event to get code of the pressed key ( ex : alphabe key, numberic key, ...). I'm in dark. Please help me, thanks.

        S Offline
        S Offline
        SABhatti
        wrote on last edited by
        #3

        you can add onKeyPress function to any textbox, textarea, list box or even to the page in body tag. write a javascript function e.g: function getkeypressed() { alert('Key code: '+ event.keyCode) } and call the above function whereever u want onkeyPress of body, textbox etc. Salim Akbar -- modified at 12:11 Friday 7th October, 2005

        1 Reply Last reply
        0
        • A Atul Kharecha

          Hi, I just solved problem like yours. Try following function keydown() { if(window.event.keyCode==13) { //logic of key pressed - it returns ascii code // this will run everytime when any key is pressed on a webform. } } ... .. ... Hope this will solve your problem. Atul. -- modified at 1:56 Friday 7th October, 2005

          V Offline
          V Offline
          vtalau
          wrote on last edited by
          #4

          I don't know how to exchange the keycode of the letter to the appropriate letter in the "keydown" event in javascript. Thanks

          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