473,385 Members | 1,593 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,385 software developers and data experts.

Forcing an A:active status on a link

Hello.

I'm working on a problem related with CSS and javascript: I have got a
link on a page and a stylesheet file that makes the background color
change when users click on it.

Is there anyone who knows if it is possible to 'force' via javascript a
status A:active on a link ? I mean: is there a property of the style
that can make the css believe a link was clicked when in reality it was
not ?

I know one could set simply a

IDlink.backgroundColor='pink'

for instance, but I am really interested in the direct interaction with
the 'active' (or hover or a visited) state.

I thank you in advance for any help.

Newcomsas

Jun 13 '06 #1
9 5396
ne*******@hotmail.com wrote:
Is there anyone who knows if it is possible to 'force' via javascript a
status A:active on a link ?
No.
I mean: is there a property of the style
that can make the css believe a link was clicked when in reality it was
not ?


:active means "is being clicked on" not "was clicked on".

You probably want to use :focus (although I don't think browser support
is great).

Moments after the link is cliecked, the browser goes to a new page
though, so its not going to be noticed by most people.

Jun 13 '06 #2
David Dorward wrote:
ne*******@hotmail.com wrote:
Is there anyone who knows if it is possible to 'force' via javascript a
status A:active on a link ?
No.
I mean: is there a property of the style
that can make the css believe a link was clicked when in reality it was
not ?


:active means "is being clicked on" not "was clicked on".

You probably want to use :focus (although I don't think browser support
is great).


Not everyone uses a mouse. When you tab through a web page, which link
or field has the focus needs to be apparent.
Moments after the link is cliecked, the browser goes to a new page
though, so its not going to be noticed by most people.


Jun 13 '06 #3
In article <11*********************@y43g2000cwc.googlegroups. com>, David
Dorward <do*****@gmail.com> writes
Moments after the link is cliecked, the browser goes to a new page
though, so its not going to be noticed by most people.


True, but if you hit the Back button afterwards, IE will still show the
link as active. Not sure if other browsers do as well.

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 13 '06 #4
Harlan Messinger wrote:
You probably want to use :focus (although I don't think browser support
is great).
Not everyone uses a mouse.
I'm very aware of that.
When you tab through a web page, which link or field has the focus needs
to be apparent.


Yes, and it would be nice if support for :focus was better - but focus is
also given to the last interactive element clicked upon, which was my
point.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jun 13 '06 #5
Alan Silver wrote:
In article <11*********************@y43g2000cwc.googlegroups. com>, David
Dorward <do*****@gmail.com> writes
Moments after the link is cliecked, the browser goes to a new page
though, so its not going to be noticed by most people.


True, but if you hit the Back button afterwards, IE will still show the
link as active. Not sure if other browsers do as well.


Bug in IE. It isn't being activated so :active should not apply.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jun 13 '06 #6
In article <e6*******************@news.demon.co.uk>, David Dorward
<do*****@yahoo.com> writes
Moments after the link is cliecked, the browser goes to a new page
though, so its not going to be noticed by most people.


True, but if you hit the Back button afterwards, IE will still show the
link as active. Not sure if other browsers do as well.


Bug in IE. It isn't being activated so :active should not apply.


I never said it wasn't a bug, I merely pointed out that it happens,
contrary to the claim you made that the active state is only seen for a
moment.

Ta ra

--
Alan Silver
(anything added below this line is nothing to do with me)
Jun 14 '06 #7
David Dorward wrote:
Harlan Messinger wrote:
You probably want to use :focus (although I don't think browser support
is great).

Not everyone uses a mouse.


I'm very aware of that.


I don't doubt it, but your remark, "moments after the link is clicked,
the browser goes to a new page though, so its not going to be noticed by
most people," seemed to imply that setting :focus was rather pointless,
so I wasn't sure you were thinking about its utility for the mouseless.
Jun 14 '06 #8
Harlan Messinger wrote:
I don't doubt it, but your remark, "moments after the link is clicked,
the browser goes to a new page though, so its not going to be noticed by
most people," seemed to imply that setting :focus was rather pointless,
so I wasn't sure you were thinking about its utility for the mouseless.


The context got a bit screwed up - I meant that trying to get the
:active state to hold after the button was released was pointless.

Jun 14 '06 #9
David Dorward <do*****@gmail.com> scripsit:
:active means "is being clicked on" not "was clicked on".


The CSS specifications define :active rather vaguely, in terms of
"activation", leaving it unspecified what constitutes activation, though
with one characterization:
"The :active pseudo-class applies while an element is being activated by the
user. For example, between the times the user presses the mouse button and
releases it."
"http://www.w3.org/TR/REC-CSS2/selector.html#x36

It is unclear whether the example indicates a case where an element _must_
be treated as active or a case where an element _might_ be treated as
active. The formulation "is being activated" seems to exclude (i.e., make
nonconforming) the IE behavior of treating a link as active after a user has
followed the link and returned.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

Jun 14 '06 #10

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

Similar topics

3
by: William Park | last post by:
(Cross-posted because I use Mozilla Firefox, but I think it's also CSS issue.) Usually when I move mouse over a link, the URL is displayed at the bottom on "status line". On some website,...
36
by: Peter Brause | last post by:
Hello, my stylesheet shows different colors for visited, active and hovered links. It works fine in IE 6, but in Opera 7 the color for the active link (red background) is never shown. How to...
11
by: Wilhelm Kutting | last post by:
Hi i got a problem running the active tag i use in my stylesheet definition #menu li a:active{ color: #8B008B; } What didt't work out Using
2
by: Kelly | last post by:
I have a subform that display requisition information. One of the fields in the subform is a combo box that shows who requested the requisition. The users can change who requested the requisition...
1
by: DaveF | last post by:
Is there a way to be able to check a url link to see if it is active or not? Example. I put urls to images in an Iframe on my site. If they change the url, It gives me an image not found error. I...
3
by: newcomsas | last post by:
Hello. I'm trying to solve a problem related to JS and CSS. I produced an HTML page with several links and buttuns. I then created a CSS file in order to display a yellow background when a link...
8
by: salad | last post by:
I was wondering how you handle active/inactive elements in a combo box. Let's say you have a combo box to select an employee. Joe Blow has been selected for many record however Joe has left the...
2
by: NielsM | last post by:
Hello All, Found a bit of Javascript on this forum that shows the title-text of a link in the statusbar, so you don't have to type onmouseover="window.status='bla di bla'" in every link. ...
0
by: shorti | last post by:
We are running DB2 UDB 8.1 fp 14 on AIX using archival logging and online backups. I was running some disaster tests and found my database restore was not restoring to the latest active log. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.