Connecting Tech Pros Worldwide Forums | Help | Site Map

setfocus after alert in javascript

amy
Guest
 
Posts: n/a
#1: Jul 19 '05
I have a text box, once the user input the value in, I do a validate
to the input, if it's invalid, then do a alert and set focus to this
control.

The alert displays, but the set focus doesn't work.Here is the client
side javascript code,

if (run!="" && IsNumber(run)==false && decimalinputvalid(run,2)==0 )
{
alert('This field only allows the entry of a maximum of 2 decimal
places. Please re-enter a correct value.');
//set focus
document.papercaltbl.printorder.focus();
}

Please give some advise. Thanks in advance.

Evertjan.
Guest
 
Posts: n/a
#2: Jul 19 '05

re: setfocus after alert in javascript


amy wrote on 02 feb 2004 in microsoft.public.inetserver.asp.general:
[color=blue]
> I have a text box, once the user input the value in, I do a validate
> to the input, if it's invalid, then do a alert and set focus to this
> control.
>
> The alert displays, but the set focus doesn't work.Here is the client
> side javascript code,
>
> if (run!="" && IsNumber(run)==false && decimalinputvalid(run,2)==0 )
> {
> alert('This field only allows the entry of a maximum of 2 decimal
> places. Please re-enter a correct value.');
> //set focus
> document.papercaltbl.printorder.focus();
>}
>
> Please give some advise. Thanks in advance.[/color]

This has nothing to do with ASP, serverside coding.

Please see a clientside js NG.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Closed Thread