I have a web form. I want the "enter" key disabled from sending the form so users have to SUBMIT in order to send form.
Have the following entered in the head:
function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = stopRKey;
It works great in the "text" form area which is in a table format. Sample:
<TR>
<TD align=right width=40%><FONT
size=2><B>First Name: </b></FONT></TD>
<TD ><INPUT name=A-firstname></TD></tr>
<TR> <TD align=right width=40%><FONT
size=2><B>Last Name: </b></FONT></TD>
<TD><INPUT name=B-lastname></TD></TR>
When I get to the radio button area it doesn't work. It is NOT in a table format. Here's a sample of the radio button area:
<p> 1. The fundamental building blocks of matter are atoms and _________.<BR>
<INPUT type=radio value="a" name="1"> a. mass <BR>
<INPUT type=radio value="b" name="1"> b. protons <BR>
<INPUT type=radio value="c" name="1"> c. molecules <BR>
<INPUT type=radio value="d" name="1"> d. neutrons </p>
Any help would be greatly appreciated.