SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    creating hotkeys...

    is there a way to create a hotkey in JavaScript?
    ie) hit the 'v' key on the keyboard and it calls a function...

    thanks.

  2. #2
    SitePoint Guru asterix's Avatar
    Join Date
    Jun 2003
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but it more of a HTML 4.0 thing, you don't need Javascript in a standards compliant browser:

    Code:
    <form action="accesskey.htm">
    <p>A field using [Alt]+]+<SPAN style="text-decoration:underline;">f</SPAN>:<br>
    <input type="text" size="40" value="Field" accesskey="f"></p>
    <p>A button using [Alt]+<SPAN style="text-decoration:underline;">b</SPAN>:<br>
    <input type="button" value="Button" accesskey="b"></p>
    </form>

    No Javascript, just HTML.
    The SPAN is to give the users a visual representation, just like a standard windows GUI.

  3. #3
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so accesskey is a set aside word that does it?

  4. #4
    SitePoint Guru asterix's Avatar
    Join Date
    Jun 2003
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, thats right. accesskey is an attribute of mostly anything with a visual representation, even <span>.

  5. #5
    SitePoint Addict
    Join Date
    Dec 2001
    Location
    Market Harborough, UK
    Posts
    206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey! I was about to ask a similar question so it has kind of saved me the trouble...

    I'd like to user Enter and Esc as my access keys - obviously, they are not printable characters, so how would I define them?

    Thanks,
    Paul Simpson, BSc, MCNI, MCNE

  6. #6
    runat="server" Golgotha's Avatar
    Join Date
    Nov 2001
    Location
    Colorado
    Posts
    2,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yep, me too, I need to use like an 'Enter' key or a 'Tab' that will call a function. This is for a handheld device.


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
  •