|
Answer» This is an example of a javascript bit that can be used inline in an anchor tag to eliminate the annoying dotted square around a link. This bit of code can be used without the need for an actual javascript code in a "script" tag:
Code: [Select]onfocus="if(this.blur)this.blur()" What I would like to know is if there is more of such bits of javascript code that can be used inline in an html tag, and where I could find them?
Hello... ?
Anybody home?
Hello... hello...?What I would like to know is if there is more of such bits of javascript code that can be used inline in an html tag
You can put any Javascript code inside an HTML event handler.
and where I could find them?
All over the place. I mean, everywhere http://www.google.com/search?hl=en&lr=&q=Javascript+example.
The code you posted isn't adviseable from an accessibility point of view. It means that people who need to navigate your links using tabs will constantly be "blurred off".
What dotted square? If you want to manage the visual look of HTML elements, use CSS, not javascript fudges.What dotted square?
Rob, you have surely noticed the highlighting that appears around links when activated.
use CSS, not javascript fudges
I don't know of any CSS property that will reliably prevent this from happening (assuming we want to stop it). I'd certainly like to know if there is any CSS non-fudge that applies here.
Okay - sorry I get what you (and the first poster) are talking about. You know that is one of those features that I've been looking at for so long, I don't even "see" it anymore! This is such a fundamental part of the way web INTERFACES work that I think breaking it might be a bad idea. When CREATING any web interface, I think we should generally try to AVOID doing things that make the site counter-intuitive. Unexpected behaviour can confuse users. And the accessibility point you raise is a good one.You know that is one of those features that I've been looking at for so long, I don't even "see" it anymore!
Ha ! I think it's likely that we both should get out a little more.
I had a look around, because I felt there was a non-script solution, and to see if in fact there was some applicable CSS.
http://codylindley.com/Javascript/223/hiding-the-browsers-focus-borders-should-i-shouldnt-i
...useful.
Further down the page, the estimable Stu Nichols suggests he can do better:
http://codylindley.com/Javascript/223/hiding-the-browsers-focus-borders-should-i-shouldnt-i#c000559
Where there is a CSS property (standards or not) that can be used, I personally think it's OK, as long as it's part of some scheme of visual clues. The "proper" browsers support the :focus pseudo, which can add all the styling one likes.
In this case, removing the link boundary (and replacing with other styling) is a little like changing text link STYLE away from underlined, blue. That is to say, it's not an accessibility issue, but one could question the wisdom of breaking convention.
Stu Nicholls' stuff blows me away.
The trouble with using CSS to achieve this effect is that it's much harder for the beginning web designer to understand the code (ESPECIALLY if it relies on IE hacks). That said, I guess if someone is thinking of messing around with the visual model to this anally-retentive extent , they either ought to learn CSS, or should switch to Flash.
There's another reason for not using the javascript at the start: on a link-laden page it's going to create code that is a pain to maintain and which slows down older spec machines. In short, a neat trick but I reckon there are better (albeit more complicated) ways of achieve a similar effect.
|