i have a text field and i want to keep a condition on this field and that condition is "i must and should take only characters and blank spaces". it must and should check after pressing the key.
That's what the JavaScript event handlers onKeyDown, onKeyUp and onKeyPress are for. This page shows them in action in the "Event Keycode Tester". [ April 08, 2007: Message edited by: Ulf Dittmer ]
Originally posted by Narasimha Raju Naidu: condition is "i must and should take only characters and blank spaces"
What else is there? Everything you can type into a text field is a character.
Assuming you meant that you want to limit to a particular type of character, such as alphabetic characters, you can achieve this by: establish a keydown handler on the text field, check the key code of the entered character, and stop the event's default handling if the character is one that you wish to block.
The details of doing so are browser-dependent so I;d suggest using a library such as Prototype that allows you to handle events in a browser-independent manner.