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 ...

Try like this while loading the page for all links

if(A1.focus == true)

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

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.

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

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.

thank you all for your ideas..:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.