onfocus event for hyperlinks

S

sybmathics

Hi,

I'm developing a website where a visistor does not have to use the mouse.
All he has to do is use the Tab-key or key-combinations to jump to specific
hyperlinks (containing accesskeys).
Next, he presses the Enter key to follow the hyperlink.

My question is: is it possible to change color of the hyperlink when a
hyperlink get the focus.
I do not only want to see the dotted line, I want the hyperlink to lighten
up.

I hope you understand what I mean.

Any help is greatly appreciated.


Sybolt
 
D

David Dorward

sybmathics said:
My question is: is it possible to change color of the hyperlink when a
hyperlink get the focus.

a:link:focus {
color: #aaaaaa;
}

a:visited:focus {
color: #aaaa00;
}

.... requires a CSS 2 browser.
 
S

sybmathics

a:link:focus {
color: #aaaaaa;
}

a:visited:focus {
color: #aaaa00;
}

... requires a CSS 2 browser.
Does not seem to be working, David.
Should the hyperlinks be in a form?

Sybolt
 
S

sybmathics

David Dorward said:
The URL to the source is visible in the image.

OK David,

I got the message.

It would be a nice idea to show people where they are on the site by
lightening up the hyperlink.
But I guess it's just too soon.

What percentage of surfers use css2 browsers? Do you have any idea?

Could there be another way of showing (beside the dotted line around the
hyperlink) people where they are, when they are using a css1 browser? Maybe,
by using Javascript?
But, you know, I really don't like that language.

g\Greets,

Sybolt
 
D

David Dorward

sybmathics said:
What percentage of surfers use css2 browsers? Do you have any idea?

Its pretty much every current graphical browser except IE. The proportion of
users varies from site to site.

I hear IE7 will include support for CSS 2 selectors, so it might start
working there.
Could there be another way of showing (beside the dotted line around the
hyperlink) people where they are, when they are using a css1 browser?
Maybe, by using Javascript?

You could simulate it with the onfocus and onblur event handlers, setting
this.className or this.style.backgroundColor. There are probably packages
out there (the badly named IE7 JavaScript for example) that can process the
stylesheet and simulate support for the :focus pseudo-class.
But, you know, I really don't like that language.

This really is the right place to announce that!
 
B

BootNic

sybmathics said:
"David Dorward" <[email protected]>

Could there be another way of showing (beside the dotted line around
the hyperlink) people where they are, when they are using a css1
browser?

<style>
a:active{
background-color: lime;
}
a:focus{
background-color: lime;
}
</style>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top