Javascript help

  • Started
  • Last post
  • 3 Responses
  • violent

    does anyone know how to remove that box around a link when its pressed?

    it seems that it happens on a mac.

    any help would be greatly appreciated thanks

  • screename0

    Hey man... you'll need 2 things. First place this function in your body tag: body onload="blurLinks();"

    then place this script in the header of the same page or in an external .js file:

    function Is ()
    { // convert all characters to lowercase to simplify testing
    var agt=navigator.userAgent.toLowerC...

    // *** BROWSER VERSION ***
    // Note: On IE5, these return 4, so use is.ie5up to detect IE5.
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion...

    this.nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1));
    this.nav2 = (this.nav && (this.major == 2));
    this.nav3 = (this.nav && (this.major == 3));
    this.nav4 = (this.nav && (this.major == 4));
    this.nav4up = (this.nav && (this.major >= 4));
    this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) );
    this.nav5 = (this.nav && (this.major == 5));
    this.nav5up = (this.nav && (this.major >= 5));

    this.ie = (agt.indexOf("msie") != -1);
    this.ie3 = (this.ie && (this.major = 4));
    this.ie5 = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
    this.ie5up = (this.ie && !this.ie3 && !this.ie4);

    this.opera = (agt.indexOf("opera") != -1);

    // *** PLATFORM ***
    this.win = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
    this.mac = (agt.indexOf("mac")!=-1);
    this.linux = (agt.indexOf("inux")!=-1);
    }

    var is = new Is();
    function unblur() {
    this.blur();
    }

    function blurLinks() {
    if (!document.getElementById) return;
    theLinks = document.getElementsByTagName("a...
    for(i=0; i<theLinks.length; i++) {
    theLinks[i].onfocus = unblur;
    }
    theMaps = document.getElementsByTagName("a...
    for(i=0; i<theMaps.length; i++) {
    theMaps[i].onfocus = unblur;
    }
    }

  • screename0

    To see it in action, just check out my personal website and view the source code.

    Hope that helps.

  • unknown0

    or you could just put this in your href:

    onFocus="if(this.blur)this.blur...