Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: recieving focus
08-20-2005, 12:51 PM #1
- Join Date
- Jan 2004
- Thanked 1 Time in 1 Post
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.
08-20-2005, 11:33 PM #2
- Join Date
- Mar 2005
- SE PA USA
- 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:
as well as: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.Code:alert(typeof element.focus())