|
1 members (Russ),
10,950
guests, and
1,516
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
S |
M |
T |
W |
T |
F |
S |
|
|
|
1
|
2
|
3
|
4
|
5
|
|
6
|
7
|
8
|
9
|
10
|
11
|
12
|
|
13
|
14
|
15
|
16
|
17
|
18
|
19
|
|
20
|
21
|
22
|
23
|
24
|
25
|
26
|
|
27
|
28
|
29
|
30
|
31
|
|
|
|
|
This is another custom island. This one could be used for ads. This spot is one of the best places for ads on your site to be placed. This can be enabled/disabled on a per forum basis.
|
|
|
|
Joined: Dec 1999
Posts: 30,868
Master Elite Member
|
Disable The Enter Key for Text Fields on a Form
function DisableEnterKey(evt) {
// Get the event object (cross-browser).
var evt = (evt) ? evt : ((event) ? event : null);
// Get the source object (cross-browser).
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
// If Enter pressed on a Textbox, return false.
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
return true;
}
document.onkeypress = DisableEnterKey;
If you want to make this apply to only a specific form on your page, change the last line to this: (Make sure change 'MyForm' to the name of your form.)
document.forms['MyForm'].onkeypress = DisableEnterKey;
|
|
|
|
Entire Thread
|
Disable The Enter Key for Text Fields on a Form
|
Russ
|
06/28/09 08:57 AM
|
|
|
|