Submitting a Form Using Enter in NetscapeBy Brian Rhee
Since I posted that little article the other day about the inconsistencies between IE and Netscape, I have received many e-mails of high praise and thanx (yes I spell it this way)... So thank you for your kind words of appreciation.
However, I did not expect to be asked by so many people regarding the script with the submit button/image in Netscape.
So here is some sample code to help you along your way. This script is very simple and shouldn't be a problem for anyone to implement.
BTW: I have received a couple of e-mails by people who have written code
similar to this but instead of submitting the information they
fire a text box first to notify the user of errored or blank fields.
Under Netscape, if you were to simply use the code I have written the
message box pops up but it repetedly pops if you try to close the alert
box using the "enter" key, in IE this is not a problem.
So the way to solve this problem is to specify where, or rather which,
element in your form you want this "return" submit to work with. The
code above shows you how to do this by setting some additonal conditional
statements using the
BTW2: This code is highly configurable and as you can see I have isolated the event that occurs when one hits the "enter" key. Instead of submitting a form you can focus on an image, or send the user to another url, or do some inline processing in the page to calculate totals or something...Hope these ideas seed your brain with the endless possibilities...