Welcome to WebmasterWorld Guest from 34.204.169.76

Forum Moderators: open

Message Too Old, No Replies

Javascript focus question

     
7:16 pm on May 20, 2003 (gmt 0)

New User

10+ Year Member

joined:May 14, 2003
posts:3
votes: 0


How can I check if a field is 'allowed' to accept focus?

disabled , hidden, or invisible fields can't...Is there an easy way to check?

7:20 pm on May 20, 2003 (gmt 0)

Administrator

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
posts:15756
votes: 0


for disabled

if (document.formname.element.disabled == true)

you can change the values of hidden or invisible elements in the script but I don't quite understand why you would need to test for that.

gph

8:33 pm on May 20, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Jan 31, 2002
posts:285
votes: 0


The lazy route :)

try {
document.getElementById('hidden-field').focus()
} catch(e) {
alert("can't focus because of\n\n" + e)
}