View Full Version : using hidefocus in the head?
hypedup.co.uk
09-22-2002, 12:53 PM
i know you can use hidefocus="true" on each individual link to hide the dotted border in IE5+, but is it possible to put something in the head that will hidefocus on all links without me having to put it on each link?
thanks, paul
boywonder
09-23-2002, 01:24 AM
try calling this function from the body onload...
<script language="JavaScript" type="text/javascript">
<!--
function hfLinks(){
var lnks=document.getElementsByTagName("A");
var i=0, j=lnks.length;
while(i<j) {lnks[i].hideFocus=true; i++;}
}
//-->
</script>
Bosko
09-23-2002, 06:20 PM
For W3c specs compliant browsers put this in your head:
<style>
a{outline:none;
-moz-outline:none}
</style>
beetle
09-23-2002, 06:27 PM
Just like that? with no selector?
Bosko
09-23-2002, 07:01 PM
Hehe,lol,my stupid mistake :o
hypedup.co.uk
09-23-2002, 10:12 PM
bosco, does your code not work in IE6?
thanks boywonder, that works fine. but is there any way to get it to work without using body onload (as it will be put in an external stylesheet) and so want to make it as easy as possible!
ive modified your code to work with imput buttons as well. let me know if theres an easier way to write this:
function nofocus() {
var links=document.getElementsByTagName("A");
var i=0, j=links.length;
while(i<j) { links[i].hideFocus=true; i++; }
var buttons=document.getElementsByTagName("input");
var i=0, j=buttons.length;
while(i<j) { buttons[i].hideFocus=true; i++; } }
beetle
09-23-2002, 10:17 PM
Originally posted by hypedup.co.uk
... is there any way to get it to work without using body onload (as it will be put in an external stylesheet) and so want to make it as easy as possible!Yes! Just add this<script>
function nofocus() {
var links=document.getElementsByTagName("A");
var i=0, j=links.length;
while(i<j) { links[i].hideFocus=true; i++; }
var buttons=document.getElementsByTagName("input");
var i=0, j=buttons.length;
while(i<j) { buttons[i].hideFocus=true; i++; } }
onload=nofocus;
</script>
hypedup.co.uk
12-01-2002, 03:34 PM
is there any way of getting this to work with netscape 6+ too? or is there no way to hide the focus for netscape browsers?
<script>
function nofocus() {
var links=document.getElementsByTagName("A");
var i=0, j=links.length;
while(i<j) { links[i].hideFocus=true; i++; }
var buttons=document.getElementsByTagName("input");
var i=0, j=buttons.length;
while(i<j) { buttons[i].hideFocus=true; i++; } }
onload=nofocus;
</script>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.