How can I determine if a particular form element has the focus at any given time? I do not want to add any event handlers to the form element. I just want to be able to read the form element’s focus ‘property’ (if such a thing exists) in my script.
@CrazyC115Jun 04.2004 — #[i]Originally posted by ssmith1000 [/i]
[B]How can I determine if a particular form element has the focus at any given time? I do not want to add any event handlers to the form element. I just want to be able to read the form element's focus 'property' (if such a thing exists) in my script. [/B][/QUOTE]
Best I could come up with is the following. An alert box will fire only if the element with the focus is a child element of "form1". I've only tested this in IE6 as well so it may not work properly with other browsers.
<i> </i><html> <head> <script type="text/javascript"> function testFocus() { var oSource = event.srcElement;