Click to See Complete Forum and Search --> : onkeypress event


nthphuong
03-14-2003, 01:57 AM
Hello,

I'm trap on key Enter press for whole form. Therefore I cannot enter for textarea field.

How can I trap key Enter and also enter for textarea?

Thanks for any help,

Phuong

gil davis
03-14-2003, 06:22 AM
Use onfocus() and onblur() of the textarea to enable/disable the trap. Something like this:var trapKey = true; // normally trap the key
function myKeyPress(e) {
if (!trapKey) return;
...
}
...
<textarea ... onfocus="trapKey=false" onblur="trapKey=true">