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

Thread: recieving focus

  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Posts
    185
    Thanks
    2
    Thanked 1 Time in 1 Post

    recieving focus

    i had thought that you could say if(function) function(); or if(element.method) element.method(); to avoid errors, but apparently not - specifically: ive got an array of form elements, on enter pass focus to the next element in the array. if that element can't recieve focus, go the next one in the array. if we've reached the end of the array, start again at the index of the event element and start going down. if it reaches 0 and still nothing, just return false i guess.

    initially tried if(target.focus) target.focus(); but that didnt work, so tried checking all the conditions i could think of (disabled, readonly, display, visibility) but that fails if the parent or the parentparent etc. are disabled, hidden, whatnot.

    any suggestions?

  • #2
    Regular Coder
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    375
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could check for those properties of the parent. If a parent element has an intrinsically inheritable trait that prevents a child element from receiving focus, that condition may be able to be detected. Try:
    Code:
    alert(element.focus)
    and
    Code:
    alert(typeof element.focus)
    as well as:
    Code:
    alert(element.focus())
    and
    Code:
    alert(typeof element.focus())
    to see if anything to work with reveals itself. I'd really need to see a more concrete example to give much more advice.


  •  

    Posting Permissions

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