ja_jamal
asked on
onfocus event for anchor <a> tag
Hi,
We are using anchor tags in the left frame (all action items), on focusing(using tab key) to the respective link, I have to change the color. I have used onFocus event, but it is not working.
I did the same for MouseOver, its working fine.
Can anybody help me to solve this problem.
Thanks,
jamal
We are using anchor tags in the left frame (all action items), on focusing(using tab key) to the respective link, I have to change the color. I have used onFocus event, but it is not working.
I did the same for MouseOver, its working fine.
Can anybody help me to solve this problem.
Thanks,
jamal
ASKER
yes .... but for key board navigation
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi ja_jamal,
The focus event is not supported by links. By far the elements of a form object (reset, submit, password, radio, etc), layers and window object are the ones that can receive focus event.
You could 'fake' it using layers instead, but that would not just highlight the text but the whole box of the layer.
- magallanl
The focus event is not supported by links. By far the elements of a form object (reset, submit, password, radio, etc), layers and window object are the ones that can receive focus event.
You could 'fake' it using layers instead, but that would not just highlight the text but the whole box of the layer.
- magallanl
try this html:
<a href=# onfocus="alert(0)">blah</a ><br>
<a href=# onfocus="alert(1)">blah</a ><br>
<a href=# onfocus="alert(2)">blah</a ><br>
click anywhere in the page and hit TAB. you'll get box saying "0". Hit TAB again. Now it says "1"... and so on.
what's the problem, really?
<a href=# onfocus="this.style.color= 'red'" onblur="this.style.color=' blue'">bla h</a><br> gives you what you want, jaysolomon is completely right, and 1st, here...
<a href=# onfocus="alert(0)">blah</a
<a href=# onfocus="alert(1)">blah</a
<a href=# onfocus="alert(2)">blah</a
click anywhere in the page and hit TAB. you'll get box saying "0". Hit TAB again. Now it says "1"... and so on.
what's the problem, really?
<a href=# onfocus="this.style.color=
Hi ja_jamal,
makc and jaysolomon are right. The onfocus handler does work. My apologies, as I was testing it using Netscape and it doesn't work quite the way it does in IE.
makc and jaysolomon are right. The onfocus handler does work. My apologies, as I was testing it using Netscape and it doesn't work quite the way it does in IE.
ASKER
thank you very much jaysolomon, makc and magallanl
do u want like this?
<a href="www.test.com" onmouseover ='this.style.color="red"' onmouseout='this.style.col
Partha