473,387 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

onfocus event for hyperlinks

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
Oct 8 '05 #1
11 2513
sybmathics wrote:
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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Oct 8 '05 #2

"David Dorward" <do*****@yahoo.com> wrote >

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
Oct 8 '05 #3
sybmathics wrote:
... requires a CSS 2 browser.
Does not seem to be working, David.
Works perfectly here.
http://dorward.me.uk/tmp/link.png

Are you using a CSS 2 browser?
Should the hyperlinks be in a form?


Irrelevant (unless you have another selector of higher specifity involving
said form overriding the CSS I suggested)

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Oct 8 '05 #4

"David Dorward" <do*****@yahoo.com> wrote in message
news:di*******************@news.demon.co.uk...

Are you using a CSS 2 browser?


the latest Maxthon and IE 6
Oct 9 '05 #5

"David Dorward" <do*****@yahoo.com> wrote in message
news:di*******************@news.demon.co.uk...

Works perfectly here.
http://dorward.me.uk/tmp/link.png


could you also create png of the source?
Oct 9 '05 #6
sybmathics wrote:
Are you using a CSS 2 browser?
the latest Maxthon and IE 6


Maxthon is, IIRC, a wrapper about the IE 6 rendering engine.

IE 6 is not a CSS 2 browser.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Oct 9 '05 #7
sybmathics wrote:
http://dorward.me.uk/tmp/link.png
could you also create png of the source?


The URL to the source is visible in the image.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Oct 9 '05 #8

"David Dorward" <do*****@yahoo.com>

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
Oct 11 '05 #9
sybmathics wrote:
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!

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Oct 11 '05 #10
> "sybmathics" <s.********@hccnet.nl> wrote:
news:43*********************@reader10.nntp.hccnet. nl....

"David Dorward" <do*****@yahoo.com>

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>

--
BootNic Wednesday, October 12, 2005 8:21 AM

I try to take one day at a time, but sometimes several days attack me at once.
*Jennifer Unlimited*
Oct 12 '05 #11
BootNic wrote:
<style>
a:active{
background-color: lime;
}
a:focus{
background-color: lime;
}
</style>


No.

<OT>

1. The `type' attribute and value are missing for the `style' element:
<http://validator.w3.org/>

2. This affects all `a' elements, not only links.
Use a:link (and a:visited) instead.

3. Always specify background *and* foreground color:
<http://www.w3.org/QA/Tips/color>

</OT>
PointedEars
Oct 16 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Scott Navarre | last post by:
Hi, I have Red Hat 8.0 and have the default Mozilla browser that comes with it. I am programming in javascript and have come across something problematic. Given the following code: <HTML>...
1
by: Rich Morey | last post by:
Hello, I have created a form and assigned each of the form elements to a class in a style sheet. I would like to know if it is possible to add 'OnFocus' and 'OnBlur' events to the style sheet...
1
by: Michael Albanese | last post by:
I am developing an application to handle my compay's OSHA reporting requirements. Some of the input criteria are technical and narowly defined, so I was trying to prvide what i call "Context...
2
by: Paresh Shah | last post by:
Hi Friends... I have an query on how to capture onFocus event for all the input controls without writing onFocus event in the <input> tag. say my html form has 3 or 4 or 5 input text boxes,...
2
by: swathi | last post by:
----------------------------------------------------------------------- A poll associated with this post was created, to vote and see th results, please visit...
1
by: Eric Trav | last post by:
Hello, I am using mozilla and javascript to change the style background color for my select with onfocus() and back to white with onblur(). When i process onfocus(); i have to click on the...
5
by: Max | last post by:
I've got a default value of some text in an input element when a page loads. What I'd like to do is have the value disappear when the user clicks in the input field. I've figured out I can use:...
2
by: Jonathan N. Little | last post by:
As part of a JavaScript precheck form validation I noticed a problem with trying to return focus to the field with an error. I have setup a demo page. ...
2
by: wolverine | last post by:
Hi All, In Mozilla Firefox, to onblur and onfocus event of each and every html element, the browser itself will attach a native event handler. I mean if you type,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.