If you have
an HTML form on your web page, many times your visitors may hit the 'Enter'
key on their keyboard, instead of the 'Tab' key, thinking it will advance
them to the next form field. However, the 'Enter' key will actually submit
the form. This will cause you to receive incomplete form submissions.
To avoid this problem, you can use a piece of JavaScript within your HTML
code that will disable the 'Enter' button within your forms until it is
completely filled out.
Here is a real form we use to enable visitors to subscribe to our eTips
publication:
Killer Internet
Marketing Strategies
Available in EXE and PDF format
An exclusive gift for eTips subscribers!
Inside, you'll discover a complete step by step guide to making a living
online.
You'll discover:
-
The Three Step Formula. If you excel
at all three, you can literally guarantee your success
-
How to Create Your Own Product to
Market on the Internet
-
How to design a Website Specifically
Designed to Sell Your Product
-
How to Write Killer Ad
Copy
-
How to Accept Payment
Online
-
How to Set Up an Affiliate
Program
-
Much More...
Make sure you don't miss this powerful
resource. Subscribe to eTips now and you will receive your download instructions
instantly.
Please rest assured that we respect your privacy and will not abuse the privledge
of your subscription or give your email address to anyone under any circumstance.
You may remove yourself at any time.
|
The above form
is real and will subscribe you to our highly popular, free weekly ezine -
eTips. However, this form is also an example of how you can disable the 'Enter'
key on your visitor's keyboard until your form is
submitted.
Place the following
JavaScript code within your web page HTML between your HEAD tags:
<script
language=javascript type=text/javascript>
<!-- Script courtesy of http://www.web-source.net - Your Guide to Professional
Web Site Design and Development
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;
-->
</script> |
Script code provided by:
John
Nitkowski
|
|