Click to See Complete Forum and Search --> : text cursor in textarea


vinsa
08-17-2003, 04:56 AM
I need for a javascript.
On my page I have two
textareas:

<input name="ta1" value="">
<input name="ta2" value="">

Is possible when the text cursor is in
textarea "ta1" and I press Enter button on the keyboard,
the script to alert "Now you will send your name us"
(this massage with OK button).
When the text cursor is in
textarea "ta2" and I press Enter button,
the script to alert "Now you will send your email us"
(this massage with OK button).

Thank you in advance.

xataku_nakusute
08-17-2003, 05:46 AM
uhhh....well...im unsure of the whole purpose of this code....but im also unsure of how to implement the enter press....

but heres kinda what youre looking for:

<input type="text" name="ta1" value="" onmouseover="alert('Now you will send your name us')">
<input type="text" name="ta2" value="" onmouseover="alert('Now you will send your email us')">

that basically does the same, but with exclusion of the pressing enter part.

also....these input fields are called textBOXES not textareas. that kinda threw me off for a sec.
when referring to textareas, youre talkin bout
<textarea></textarea>
and textboxes
<input type="text>

vinsa
08-17-2003, 11:52 AM
Thanks but I want when the text cursor is in textarea and I press Enter button on the keyboard.

xataku_nakusute
08-17-2003, 08:02 PM
<input type="text" name="ta1" value="" onmouseover="focus()" onmouseout="blur()" onkeydown="alert('Now you will send your name us')">
<input type="text" name="ta2" value="" onmouseover="focus()" onmouseout="blur()" onkeydown="alert('Now you will send your email us')">

thats prolly more of what youre looking for

EDIT: sorry for messing up again.
the code above will make the alert poup whenever ANY kboard button is pressed.....which in turn would make your forms very annoying
ill try to get you the right code soon