McKirahan wrote:
"Denis Perelyubskiy" <ne********@dslextreme.com> wrote in message
news:10*************@corp.supernews.com...
Hello,
Is there a way to detect which textarea the cursor is positioned in? I
would not want to attach 'onkeypress' to all textareas to detect which
one I am presently in ... or is this the only option?
How will you handle mouse clicks?
I did not think of that, but I was just throwing out an option :)
Why do you need do to this?
I am trying to make an extension for Firefox, which will process
keypresses for textareas. This will require that 'onkeypress' be
attached dynamically. The functionality is event-driven (some key
combination shall trigger it). I could either iterate through all
forms/textareas (I hope :)) and attach my handlers to all of them, or
try to be more intelligent and attach the event handler only to the form
in which I detect the cursor at a point when my key combination is fired.
I admit this may not be the cleanest way of doing things, but this is my
first attempt at this - btw, if you have any suggestions, I'd absolutely
love to hear them.