setfocus after alert in javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • amy

    setfocus after alert in javascript

    I have a text box, after user input the value, a validate function
    trigered. if the value is invalid, alert display, and also set focus
    back to this control.

    The alert displays, but when the click the 'OK' in the alert, the set
    focus to this field does not work.

    see the code bellow:

    if (run!="" && IsNumber(run)== false && decimalinputval id(run,2)==0 )
    {
    alert('wow');

    //first try doen not working
    (setFocus) ? document.paperc altbl.printorde r.focus() : ""

    //seconde try doen not working
    this.getField(" printorder").se tFocus();

    //third try doen not working
    document.getEle mentById("print order").focus() ;
    }

    Please give some advise. Thanks in advance.
  • DJ WIce

    #2
    Re: setfocus after alert in javascript

    Are you sure that
    setFocus
    is global?

    the
    this
    will probable not refer to what you want.

    I assume the focus error comes in Mozilla/Netscape?
    Maybe you should put an url or or more info into your question?

    Wouter

    "amy" <ajiwu@elario.c om> wrote in message
    news:7f6c5b13.0 402021506.65e15 cc5@posting.goo gle.com...
    : I have a text box, after user input the value, a validate function
    : trigered. if the value is invalid, alert display, and also set focus
    : back to this control.
    :
    : The alert displays, but when the click the 'OK' in the alert, the set
    : focus to this field does not work.
    :
    : see the code bellow:
    :
    : if (run!="" && IsNumber(run)== false && decimalinputval id(run,2)==0 )
    : {
    : alert('wow');
    :
    : //first try doen not working
    : (setFocus) ? document.paperc altbl.printorde r.focus() : ""
    :
    : //seconde try doen not working
    : this.getField(" printorder").se tFocus();
    :
    : //third try doen not working
    : document.getEle mentById("print order").focus() ;
    : }
    :
    : Please give some advise. Thanks in advance.


    Comment

    Working...