You are here: irt.org | FAQ | JavaScript | Form | Q1398 [ previous next ]
Submitted by Ben Crosson:
There seem to be 5 or 6 entries in this FAQ which imply that this isn't possible. They simply suggest putting onBlur="self.focus()" in the body tag. However, this locks users out from entering information into form fields. It is possible to get around this though. Simply put the follwing 2 functions in the header of your page, and then in the body tag, as well as in the tag of every form field, put onBlur="blurred()" onFocus="focused()". This will solve this often complained about problem.
<script language="JavaScript"> var timer = ''; function blurred() { timer = setTimeout('self.focus()',1); } function focused() { if (timer != '') clearTimeout(timer); } </script>