Block enter textfield : JavaScript DHTML examples (example source code) » Form Control » TextField

JavaScript DHTML
C++
Java Products
Java Articles
JavaScript DHTML Home  »   Form Control   » [  TextField  ]   
 



Block enter textfield

<!-- 
     Example File From "JavaScript and DHTML Cookbook"
     Published by O'Reilly & Associates
     Copyright 2003 Danny Goodman
-->


function blockEnter(evt) {
    evt = (evt? evt : event;
    var charCode = (evt.charCode? evt.charCode :
        ((evt.which? evt.which : evt.keyCode);
    if (charCode == 13) {
        return false;
    else {
        return true;
    }
}
...
<input type="text" name="search" size="40" onkeydown="return blockEnter(event)" />
Related examples in the same category
1.  TextField focus and select all
2.  Show TextField value in Dialog
3.  TextField focus, blur, and click action
4.  Display textfield value in new page
5.  JavaScript Loan Calculator
6.  Another TextField jump
7.  TextField get Focus and clear content
8.  Validate an input field with minimum and maximum values
9.  Validate an field with a maximum number of characters
10.  Select the textfield and focus
11.  Focus an input field
12.  Jump to the next field
13.  Get textfield value
14.   Methods and Properties of the Text Object
15.  Selecting Text Upon Focus
16.  assign a default value to a Text object
17.  Compound Interest Calculator
18.  Resetting a Text Object to Default Value
19.  Getting and Setting a Text Object's Value
20.  Passing a Text Object (as this) to the Function
21.  Text Object Select and Focus
22.  Data Validation via an onChange event Handler
23.  Add textfield dynamically into HTML
24.   Firing the onSame Event (FireFox)
25.  Numerals Only
26.  Letter only, yes no only textfield
27.  Auto focus textfield
28.  If the textfield has been changed








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.