469,343 Members | 5,478 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

Focus on Select

Hi,

Is there a way to focus on a drop down list of a form.

I tried element.focus() select() click() in vain....

TIA
Regards,
Nicky.
Jul 20 '05 #1
2 2915
"Nicolas Mainczyk" <nm*******@hotmail.com> wrote in message news:<br*********@ngspool-d02.news.aol.com>...
Hi,

Is there a way to focus on a drop down list of a form.

I tried element.focus() select() click() in vain....


Where did you call focus()? The following worked fine for me:

....
function init() {
document.forms[0]["items"].focus();
}
....
<body onload="init()">
....
<select name="items">
Jul 20 '05 #2
Chris Riesbeck wrote:
"Nicolas Mainczyk" <nm*******@hotmail.com> wrote in message news:<br*********@ngspool-d02.news.aol.com>...
Your attribution line exceeds the recommended maximum of 78 characters
per line. This is not necessary since it contains a lot of superfluid
information that can be retrieved through message headers by those who
are really interested in it.
I tried element.focus() select() click() in vain....


Where did you call focus()? The following worked fine for me:

....
function init() {
document.forms[0]["items"].focus();


The sane way is

document.forms[0].elements["items"].focus();
}

Merry Christmas! (if you celebrate it)

PointedEars
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Paul Thompson | last post: by
9 posts views Thread by Roger Withnell | last post: by
8 posts views Thread by Yeah | last post: by
17 posts views Thread by Neil Ginsberg | last post: by
1 post views Thread by Josh C. | last post: by
2 posts views Thread by Jonathan N. Little | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.