Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

finding the currently active link?

  • 03-04-2006 12:58PM
    #1
    Registered Users, Registered Users 2 Posts: 2,342 ✭✭✭


    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, Registered Users 2 Posts: 2,342 ✭✭✭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