Try this:

<script language="text/javascript">
var activeElement = null;
function blurHandler(evt) {
        activeElement = null;
}
function focusHandler(evt) {
        var e = evt ? evt : window.event;
        if (!e) {
                return;
        }
        if (e.target) {
                activeElement = e.target;
        } else if(e.srcElement) {
                activeElement = e.srcElement;
        }
}
function loadHandler() {
        var i, j;
        for (i = 0; i < document.forms.length; i++)
                for (j = 0; j < document.forms[i].elements.length; j++) {
                        document.forms[i].elements[j].onfocus = focusHandler
                        document.forms[i].elements[j].onblur  = blurHandler
                }
}
window.onload = loadHandler
</script>

You can then access activeElement.id or activeElement.name to see what
has focus.

On 12/26/06, Brad Wood <[EMAIL PROTECTED]> wrote:
> I have downloaded and played around with Prototype before.  I'm not sure
> it will help me though with this.  All the observe functionality does is
> let me attach event listeners.  My problem is that I have no way to
> programmatically determine whether a given element has focus while
> possessing the event of another element.
>
> ~Brad
>
> -----Original Message-----
> From: Robertson-Ravo, Neil (RX)
> [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 26, 2006 4:53 PM
> To: CF-Talk
> Subject: Re: HTML focus
>
> Have a look at prototype etc for Observers if you want to use a JS
> framework, if not you can just roll your own, not too hard, basic field
> validation really.
>
>
>
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:265055
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to