A prototype way might go something like this (untested): var focused; Event.observe(document, 'dom:loaded', function() { $$('input, select, textarea').invoke('observe', 'focus', function(event) { focused = event.element(); }); });
-Hector On Wed, Nov 19, 2008 at 7:50 AM, EMoreth <[EMAIL PROTECTED]> wrote: > > You can play with something like this: > > <html> > <head> > <SCRIPT LANGUAGE=javascript> > var CurrentObj; > </SCRIPT> > </head> > <body onfocusin="CurrentObj=event.srcElement;alert(CurrentObj.name)"> > <form> > <input type = "text" name = "txt"> > <input type = "text" name = "txt1"> > <select name = "sel"><option>1</option></select> > </body> > </html> > > It is not prototype based but is very usefull.(Not tested in other > than IE) > > Emoreth > > On 19 nov, 09:25, Jeztah <[EMAIL PROTECTED]> wrote: > > Is there a mthod on prototype or nativejs to work out what part of the > > document the user is focused on currently ? > > > > I am trying to iron out a bug in somehting and need to work out what > > element they are currently on (form/div/span etc etc) > > > > Regards > > Alex > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---