Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2006
    Posts
    243
    Thanks
    14
    Thanked 2 Times in 2 Posts

    check if textInput.focus == true?

    How can I check if the focus is on a particular textfield?

    I want to make a statement like below (though preferably a working one ), the code should only be executed when the focus is not the field:

    Code:
    if ( myForm.textInput.focus != true )
    {
        task
    }
    Last edited by Kirl; 10-16-2006 at 05:00 PM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Just do
    Code:
    myForm.textInput.onfocus = function()
    {
    task
    }
    or put onfocus="doSomething()" in the actual input box.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •