Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

finding the currently active link?

Options
  • 03-04-2006 12:58pm
    #1
    Registered Users Posts: 2,343 ✭✭✭


    Hi,

    i'm helping out on the techy side of a development project running on symbol handhelds, the software is a web app running in internet explorer.

    we're trying to make the whole app keyboard navigable and have almost succeeded.

    however there is one stumbling block remaining. we want to re-write the tab/shift-tab moving between links functionality to use different buttons as the tab function on the handheld requires a couple of keystrokes.

    we have the software from symbol that can override any keystroke and execute a javascript function but we're struggling to get the navigation working.

    the crux of the problem is in finding out which link is currently active, reading document.activeElement but this gives us the url of the link as opposed to a useful refernce of the style document.links[13]

    does anyone have any pointers as to how we might get such a reference as then setting focus to the next link would be simple enough, or alternatively is it possible to get javascript to replay a keystroke sequence to the browser, i had thought it was but can't seem to find anything

    any thoughts?


Comments

  • Registered Users Posts: 2,343 ✭✭✭JohnBoy


    <html>
    <script>

    function whichFocus()
    {
    var obj = document.activeElement;
    if (obj != null)
    FOCUS.value = obj.id;
    }

    setInterval("whichFocus()",1000);

    </script>
    <a href="www.dell.ie" id="1"> dell </a>
    <a href="www.google.ie" id="2"> google</a>
    <input id="X1"/>
    <input id="X2"/>
    <input id="FOCUS"/>
    </html>



    found that and hacked it about


Advertisement