PDA

View Full Version : bit of code ( this.blur() ) in external js


qwertyuiop
04-20-2004, 02:31 AM
hello, this is a simple javascript thing:

on www.htmlgoodies.com/beyond/nodottedline.html there is a little bit of code that gets rid of that dotted border. I would like it use this on all/some of my links without typing <a class="cc" href="..." onclick="this.blur()">link</a> a whole bunch of times. How can i place the onclick="this.blur()" in a .js file? I only want this to apply to links though.

whoa, i made it sound long and confusing... :rolleyes:

glenngv
04-20-2004, 02:47 AM
Why do you want to remove the dotted border? That would have an accessibility problem because tabbing from one link to another is suppressed.

But if you insist, here's the code:

function blurLinks(){
for (var i=0;i<document.links.length;i++){
document.links[i].onfocus=function(){this.blur()};
}
}

then call it by:

window.onload=blurLinks;

or

<body onload="blurLinks()">