PDA

Click to See Complete Forum and Search --> : Events


lenin
Nov 14th, 2000, 10:16 AM
Hi,
can someone let me know what event ( if any ) is fired when a user types something in a text box WITHOUT exiting the control. I don't think the answer is onChange, this requires exiting the control

"The onChange event handler executes JavaScript code when input focus exits the field after the user modifies its text. "

http://www.eborcom.com/webmaker/tutorials/rhoque/event2.html#onChange

I want to flag a message if the cotents of a text box are changed without leaving the control, so if, for example a textbox contains the worg dog and I delete the g then the event would fire.

Thanks in advance.

Lenin.

Nov 14th, 2000, 12:40 PM
You can try the onKeyDown event but I'm not sure how widely supported it is. It might only work in IE. Here's an example of how it can work:


<HTML>
<HEAD>
<TITLE>test.asp</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function echoIt()
{
parText.innerHTML = txtTest.value;
}
-->
</SCRIPT>
</HEAD>
<BODY>

<INPUT NAME="txtTest" ID="txtTest" SIZE=20 onKeyDown="echoIt()">

<P NAME="parText" ID="parText"></P>

</BODY>
</HTML>



Paul

lenin
Nov 15th, 2000, 03:26 AM
Many thanks Paul. That did the trick.

Lenin