Click to See Complete Forum and Search --> : Where is the focus ?


Shrish_Mishra
May 9th, 2004, 08:32 AM
Is there any way in Javascript to find on which button the current focus is ? and it can tell on which button the focus is when the focus is changed.
I searched in FAQs but couldnt find can you help me ;-)

-Shrish

PallaviDalvi
June 23rd, 2004, 03:38 AM
the onfocus of any control wud tell if that control has the focus. in anycase when u call a function the focus is always on the control that calls the function... so u cannot possibly check if any other control has focus. to make my self clear...

<input type=text onclick="chk_focus();">
chk_focus() cannot tell me if button1 or button2 has the focus... coz in this case ONLY textbox can have focus.

so instead if i do
<input type=button onfocus="do_something();"> this can tell me where the focus currently is and also lets me follow the focus.

incase u have any special reason for doing what u want to... maybe an explanation of the case might help.