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. HotKeys for HREF links

HotKeys for HREF links

Scheduled Pinned Locked Moved Web Development
htmlquestion
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.
  • D Offline
    D Offline
    Daredeviljpr
    wrote on last edited by
    #1

    hi folks, is it possible to define hotkeys for href-links in the html, so the user may select them by simply pressing this keys ? (w/o having to scroll through the whole page)

    M E V 3 Replies Last reply
    0
    • D Daredeviljpr

      hi folks, is it possible to define hotkeys for href-links in the html, so the user may select them by simply pressing this keys ? (w/o having to scroll through the whole page)

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Hi there, IMO, you can implement this functionality with the client side script. You basically need to do the things: + Capture when a key is pressed, you can create am event handler for the onkeydown[^]/onkeypress[^] events of the body element. + Based on the keyCode of the pressed key, you can get the appropriate link and take a proper action. The sample code is something like:

      function CaptureHotKey(e)
      {
      if (e.keyCode == 65)//The keyCode of 'A' is 65.
      {
      //Get the expected link for the keyCode 65.
      var href = document.getElementById("link1");

      	//Take the proper action: set focus on it or navigate to its url.
      	href.focus();
      	//window.location.href = href;
      }
      ....
      

      }
      ....
      <body onkeydown="CaptureHotKey(event);">

      + [Edit]You can also take a quick look at the ACCESSKEY Attribute | accessKey Property [^][/Edit] -- modified at 22:23 Wednesday 31st August, 2005

      1 Reply Last reply
      0
      • D Daredeviljpr

        hi folks, is it possible to define hotkeys for href-links in the html, so the user may select them by simply pressing this keys ? (w/o having to scroll through the whole page)

        E Offline
        E Offline
        enjoycrack
        wrote on last edited by
        #3

        hi there, u can define a hotkey for href element. So user just simply press Alt+ character that u defined, then the link will get focus. below is the sample code: press Alt-C Hope this helps << >>

        1 Reply Last reply
        0
        • D Daredeviljpr

          hi folks, is it possible to define hotkeys for href-links in the html, so the user may select them by simply pressing this keys ? (w/o having to scroll through the whole page)

          V Offline
          V Offline
          Vasudevan Deepak Kumar
          wrote on last edited by
          #4

          ACCESSKEY attribute.:) :) Vasudevan Deepak Kumar Personal Web: http://www.lavanyadeepak.tk/ I Blog At: http://deepak.blogdrive.com/

          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