...

View Full Version : recieving focus



subhailc
08-20-2005, 12:51 PM
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?

jscheuer1
08-20-2005, 11:33 PM
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:

alert(element.focus)and

alert(typeof element.focus)as well as:

alert(element.focus())and

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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum