mouseless navigation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron Fude

    #1

    mouseless navigation

    Hi,

    Can someone give me broad tips on whether it is possible to make a site
    keyboard navigatable?

    I know that you can do it with "tab" but in most cases that's annoying. I'm
    curious whether it is possible to assign shortcut keystrokes to certain
    buttons, links, etc.

    Many thanks!

    Aaron Fude


  • Thomas 'PointedEars' Lahn

    #2
    Re: mouseless navigation

    Aaron Fude wrote:
    [color=blue]
    > Can someone give me broad tips on whether it is possible to make a site
    > keyboard navigatable?
    >
    > I know that you can do it with "tab" but in most cases that's annoying.
    > I'm curious whether it is possible to assign shortcut keystrokes to
    > certain buttons, links, etc.[/color]

    This has nothing to do with client-side scripting (and should not,
    since it can be restricted, disabled or not even present).

    <http://www.w3.org/TR/html4/interact/forms.html#adef-accesskey>


    HTH

    PointedEars

    Comment

    • Robert

      #3
      Re: mouseless navigation

      "Aaron Fude" <aaronfude@yaho o.com> wrote in message news:<cfenas$19 vn$1@news.wplus .net>...[color=blue]
      > Hi,
      >
      > Can someone give me broad tips on whether it is possible to make a site
      > keyboard navigatable?
      >[/color]


      If the html access key solution does not meet your needs, here is a
      javascript function that intercepts key presses. The code follows.
      Robert


      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      <head>
      <title>shortc ut keys</title>

      <SCRIPT type="text/javascript">

      function processKey(even t)
      {
      if ( typeof event == "object" &&
      typeof event.which == "number")
      {
      // Netscape
      alert("event.wh ich = " + typeof event.which + " " + event.which
      +
      " event.shiftKey = " + event.shiftKey +
      " event.ctrlKey = " + event.ctrlKey +
      " event.altKey = " + event.altKey +
      " event.metaKey = " + event.metaKey);

      //control-y goes to yahoo
      if (event.which == 121 && event.ctrlKey == true)
      {
      location.replac e("http://www.yahoo.com") ;
      return false;
      }

      }
      else
      {
      // We assume IE
      /*
      Big worning: For some reason if you put out an
      alert here, the letter will not get get inserted into
      a text field.

      alert("window.e vent.keyCode = " + event.keyCode);
      */

      // The Netscape & IE keycodes differ.
      // It seems easyist just to insert the above alter and see
      // what number is shown.
      //
      //control-y goes to yahoo
      if (window.event.k eyCode == 25)
      {
      alert("replacin g");
      location.replac e("http://www.yahoo.com") ;
      return false;
      }

      }

      return true;
      }


      /* Looks like you can either set the event handler via the
      statement below or in the onkeypress event handler of the
      html body statement. If you use the statement below, you
      will not be passing the event variable to the function
      processKey and you will have to preference window to
      the event variables for the IE portion of the code.

      document.onkeyp ress = processKey;
      */

      </SCRIPT>
      </head>
      <body onkeypress='ret urn processKey(even t);'>
      <p>Lets look for a key press.</p>
      <form>
      <input type=text size=20>
      </form>
      </body>

      Comment

      Working...