954,116 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Link with Focus

hi guys, just want to ask if it is possible to check which link on the page receives a focus? For example, i got Links name A1, A2, A3, A4 and A5. How to check which link is currently receiving the focus? is it possible to do? thanks ...

cguan_77
Nearly a Posting Virtuoso
1,317 posts since Apr 2007
Reputation Points: 19
Solved Threads: 115
 

Try like this while loading the page for all links

if(A1.focus == true)
chandru7
Junior Poster in Training
72 posts since Sep 2009
Reputation Points: 9
Solved Threads: 13
 
hi guys, just want to ask if it is possible to check which link on the page receives a focus? For example, i got Links name A1, A2, A3, A4 and A5. How to check which link is currently receiving the focus? is it possible to do? thanks ...


there is a event called onfocus.... add that to the links and a function that tells you what was focused...
read more about that here: http://www.w3schools.com/tags/tag_a.asp

futingkiller
Newbie Poster
17 posts since Oct 2009
Reputation Points: 10
Solved Threads: 2
 
hi guys, just want to ask if it is possible to check which link on the page receives a focus? For example, i got Links name A1, A2, A3, A4 and A5. How to check which link is currently receiving the focus? is it possible to do? thanks ...
someLink.onfocus=doYourThing


Where "doYourThing" is the function you want to invoke when that paricular link has recieved focus.

Troy III
Practically a Master Poster
609 posts since Jun 2008
Reputation Points: 120
Solved Threads: 80
 
someLink.onfocus=doYourThing

Where "doYourThing" is the function you want to invoke when that paricular link has recieved focus.


is not exactly like that, more like:
link1
the only problem with this is that onfocus occurs when onclick(when you click) occurs, you usualy use onfocus when you are using or something similar

futingkiller
Newbie Poster
17 posts since Oct 2009
Reputation Points: 10
Solved Threads: 2
 
is not exactly like that, more like: link1 the only problem with this is that onfocus occurs when onclick(when you click) occurs, you usualy use onfocus when you are using or something similar


No..., its exactly like that.
Inline scripts are, 'a bad coding practice' everybody agrees upon. Me to.
The onfocus event gets fired when element receives focus. That's all you need to know. And there are many ways to send focus to element. You can even do it by script.
ie someLink.focus()
will suffice.Link focus is implemented for accessibility reasons and especially for keyboard navigation ability.

Troy III
Practically a Master Poster
609 posts since Jun 2008
Reputation Points: 120
Solved Threads: 80
 

thank you all for your ideas..:)

cguan_77
Nearly a Posting Virtuoso
1,317 posts since Apr 2007
Reputation Points: 19
Solved Threads: 115
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You