944,221 Members | Top Members by Rank

Ad:
Nov 6th, 2009
0

Link with Focus

Expand Post »
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 ...
Last edited by cguan_77; Nov 6th, 2009 at 7:07 am.
Similar Threads
Reputation Points: 19
Solved Threads: 115
Nearly a Posting Virtuoso
cguan_77 is offline Offline
1,317 posts
since Apr 2007
Nov 6th, 2009
0
Re: Link with Focus
Try like this while loading the page for all links

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. if(A1.focus == true)
Reputation Points: 9
Solved Threads: 13
Junior Poster in Training
chandru7 is offline Offline
72 posts
since Sep 2009
Nov 6th, 2009
0
Re: Link with Focus
Click to Expand / Collapse  Quote originally posted by cguan_77 ...
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
Reputation Points: 10
Solved Threads: 2
Newbie Poster
futingkiller is offline Offline
17 posts
since Oct 2009
Nov 6th, 2009
0
Re: Link with Focus
Click to Expand / Collapse  Quote originally posted by cguan_77 ...
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.
Reputation Points: 120
Solved Threads: 61
Posting Pro
Troy III is offline Offline
513 posts
since Jun 2008
Nov 6th, 2009
0
Re: Link with Focus
Click to Expand / Collapse  Quote originally posted by Troy III ...
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:
<a href="" onfocus="some_function">link1</a>
the only problem with this is that onfocus occurs when onclick(when you click) occurs, you usualy use onfocus when you are using <input type=text> or something similar
Reputation Points: 10
Solved Threads: 2
Newbie Poster
futingkiller is offline Offline
17 posts
since Oct 2009
Nov 6th, 2009
0
Re: Link with Focus
is not exactly like that, more like:
<a href="" onfocus="some_function">link1</a>
the only problem with this is that onfocus occurs when onclick(when you click) occurs, you usualy use onfocus when you are using <input type=text> 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.
Reputation Points: 120
Solved Threads: 61
Posting Pro
Troy III is offline Offline
513 posts
since Jun 2008
Nov 11th, 2009
0
Re: Link with Focus
thank you all for your ideas..
Last edited by cguan_77; Nov 11th, 2009 at 9:47 am.
Reputation Points: 19
Solved Threads: 115
Nearly a Posting Virtuoso
cguan_77 is offline Offline
1,317 posts
since Apr 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: how do i make a simple scrollbar with javascript and css
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: is it possible to over write internal java script?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC