Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

focus()

Question posted by: Philip WATTS (Guest) on July 20th, 2005 11:03 AM
I have written a function that checks the format of the text entered into a
form field. The function is called by an onBlur() event and checks the
format of the script which, if it is incorrect calls a second function to
display an alert() message. Both functions end with a return statement.

My problem is that the cursor returns to the following form field, and not
the one that I have just checked. I assume this is because my function is
called on a "onBlur()" event and so the return will send the cursor/script
to the next item, my next form field.

Is there a way of placing the focus to the field that I want?

Thanks


Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
Hywel Jenkins's Avatar
Hywel Jenkins
Guest
n/a Posts
July 20th, 2005
11:04 AM
#2

Re: focus()
In article <bm6ude$mre$1@newsg1.svr.pol.co.uk>,
Join Bytes! says...[color=blue]
> I have written a function that checks the format of the text entered into a
> form field. The function is called by an onBlur() event and checks the
> format of the script which, if it is incorrect calls a second function to
> display an alert() message. Both functions end with a return statement.
>
> My problem is that the cursor returns to the following form field, and not
> the one that I have just checked. I assume this is because my function is
> called on a "onBlur()" event and so the return will send the cursor/script
> to the next item, my next form field.
>
> Is there a way of placing the focus to the field that I want?[/color]

document.FormName.FieldName.focus();

--
Hywel I do not eat quiche
http://hyweljenkins.co.uk/
http://hyweljenkins.co.uk/mfaq.php

 
Not the answer you were looking for? Post your question . . .
183,632 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Latest Articles: Read & Comment
  • Didn't find the answer you were looking for?
    Post Your Question
  • Top Community Contributors