[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Focus method not working



If you looks at the Release Notes under the Help menu you'll find that
select and focus are NYI on most platforms.

blur() and change() also have their quirks.

I'd just try and stay away from these until 2.1 comes out or a patch is
released.  The problem lies in GUI specific coding on Netsape's part.

At 08:08 AM 2/13/96 -0800, you wrote:
>Greetings everybody:
>
>I sent this message yesterday and noticed the last half of my message 
>was cut off. Sorry! I am having problems with using the focus method in 
>a function that is suppose to validate a field. I have had good luck with
>using the focus method to set my cursor to a specific field on an onLoad 
>function I have, but when I try to put the focus method in my validate function
>it doesn't work. Here is the validate function:
>
>  <SCRIPT LANGUAGE=JavaScript>
>  function validate_uid(obj) {
>    if (obj.value.length != 6) {
>      alert("\nInvalid ID Length. \nPlease enter a 6 character UID.\n");
>      obj.focus();
>      obj.select();
>    }
>  }
>  </SCRIPT>
>
>I have tried to use both the onBlur and onChange event on the UID field.
>
>  <input type="text" name="user_id" size=25 onChange="validate_uid(this)">
>
>The alert works, the select works, but the focus doesn't. For example, I enter
>'12' in the UID field and hit TAB, the function gives me the alert, selects
>the text, but lets the cursor go to the next field. I tried this using 
>Navigator for Windows 95, Windows NT, and SunOS. It worked on the Mac.
>Any advice?
>
>-- Jeff
>
>-----------------------------------------------------------------
>Jeffrey Hunter                         | EMAIL: jhunter@llnl.gov
>Computer Scientist                     | PHONE: (510) 423-0271
>Lawrence Livermore National Laboratory | FAX  : (510) 422-2384
>P.O. Box 808,  L-434                   | 
>Livermore, CA 94551                    |
>-----------------------------------------------------------------
>
>