Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Saskatoon SK Canada
    Posts
    174
    Thanks
    2
    Thanked 0 Times in 0 Posts

    what's the javascript to remove the dots around links

    I use <a href="something.html" onfocus="this.blur();">link or img</a> and it works fine. It doesn't work in image maps though. What code works in image maps to not show that ugly link dotted focus area?

    Example of what doesn't work:
    <area shape="rect" coords="279,145,377,209" onfocus="this.blur();" href="index.htm">

    What's the trick?
    Colin Puttick

  • #2
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Using onfocus="this.blur" can knacker accessibility and usability for those using the keyboard to navigate around a page/site.

    Consider using a less harmful approach…
    http://cssplay.co.uk/menu/nodots.html
    http://www.cssplay.co.uk/menus/ndlrt.html

    Consider also whether it's actually that important for you to remove it…
    http://codylindley.com/Javascript/22...d-i-shouldnt-i

  • #3
    Regular Coder
    Join Date
    Oct 2006
    Posts
    107
    Thanks
    3
    Thanked 5 Times in 5 Posts
    onclick="window.focus();morestuff()"

  • #4
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Quote Originally Posted by rubenbuhr View Post
    onclick="window.focus();…
    Again, this isn't a particularly user-friendly approach.
    The onclick event can be triggered by usual activation such as pressing the enter/return key on a focussed link - the method most commonly used by keyboard users.
    This would whip away the focus to somewhere else on the page (or nowhere).
    This breaks the sequence of tabbed elements for keyboard users, meaning that if they want to activate/click the link after the one they've just activated/clicked, they may have to start from the very first tab element on the page.
    Every time they activate a link, the focus is reset, breaking their context and their flow.

    Avoid it, if possible.
    Last edited by Bill Posters; 11-08-2006 at 06:35 PM.

  • #5
    Regular Coder
    Join Date
    Sep 2002
    Location
    Saskatoon SK Canada
    Posts
    174
    Thanks
    2
    Thanked 0 Times in 0 Posts
    The boss says it's ugly so I want to get rid of it.

    I tried:
    a:focus {
    width: 0;
    height: 0;
    }

    No change.
    Colin Puttick

  • #6
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here are a couple articles on the subject that I found:

    http://codylindley.com/Javascript/22...ld-i-shouldnt-
    http://www.cssplay.co.uk/menu/nodots.html#nogo7

    Might be worth checking out. I couldn't get the hideFocus idea to work for an area although it worked fine for a link. I messed with the second one a bit and couldn't get it to work in my easy test case before I had to stop. I wish you better luck.

    david_kw

  • #7
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,608
    Thanks
    0
    Thanked 645 Times in 635 Posts
    The CSS for removing the dotted box around the object with the focus is:

    outline-style:none;
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #8
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Quote Originally Posted by dreamingdigital View Post
    The boss says it's ugly so I want to get rid of it.

    I tried:
    a:focus {
    width: 0;
    height: 0;
    }

    No change.
    Have you actually read either of the articles to which I linked that show CSS-based techniques?

    Quote Originally Posted by david_kw View Post
    Pay attention, mate.


    Quote Originally Posted by felgall View Post
    The CSS for removing the dotted box around the object with the focus is:

    outline-style:none;
    Best not to simply remove the outline, but to replace it, as demonstrated in the articles to which I previously linked.

  • #9
    Regular Coder
    Join Date
    Sep 2002
    Location
    Saskatoon SK Canada
    Posts
    174
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks Stephen,

    <area ... style="outline-style:none;"> was the trick.
    Colin Puttick

  • #10
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    :sigh:


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •