I’m having some questions about changing the class/state of a link back to normal in ie6. I’m using a:active to change the background of a span when the user clicks on it. The target of the link is set to javascript:void(0), so clicking on the link just invokes a JS function I have.
However, when the user releases the mouse button, the a:active state to be removed for the link, the background changed back to normal, but in ie6 it does not. It keeps the depressed background I’ve set in a:active.
Does anyone have any suggestions about how to fix this?
In IE6, “active” is sometimes analogous to “focused”. The DOM object will remain “active” until another element receives focus, or it is blurred. If you add a JavaScript onMouseUp event to the link which calls
blur(), it should release the active state when the user’s mouse button releases:This will ensure you can use any href you want (javascript:void(0), #, whatever)