Nov 7, 2003 #1 Kendel Programmer Apr 24, 2002 1,512 US Hello All, Do you know how to set focus on a dropdown list? This: document.form1.control.focus() will work if the control is a textbox. If the control is a dropdown list, then it won't work. Thanks.
Hello All, Do you know how to set focus on a dropdown list? This: document.form1.control.focus() will work if the control is a textbox. If the control is a dropdown list, then it won't work. Thanks.
Nov 10, 2003 #2 LakshmiKiran Programmer Jul 1, 2003 22 IN Focus works fine even if it's a drop down. For eg.. <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <TITLE></TITLE> <SCRIPT LANGUAGE=javascript> <!-- function FocusMe() { document.test1.select1.focus(); } --> </SCRIPT> </HEAD> <BODY> <form name="test1" method="POST" > <SELECT id=select1 name=select1> <OPTION> 1</OPTION> <OPTION> 2</OPTION> </SELECT> <INPUT type="button" value="Button" id=button1 name=button1 onclick="javascript:FocusMe()"> </form> </BODY> </HTML> Upvote 0 Downvote
Focus works fine even if it's a drop down. For eg.. <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <TITLE></TITLE> <SCRIPT LANGUAGE=javascript> <!-- function FocusMe() { document.test1.select1.focus(); } --> </SCRIPT> </HEAD> <BODY> <form name="test1" method="POST" > <SELECT id=select1 name=select1> <OPTION> 1</OPTION> <OPTION> 2</OPTION> </SELECT> <INPUT type="button" value="Button" id=button1 name=button1 onclick="javascript:FocusMe()"> </form> </BODY> </HTML>
Nov 10, 2003 Thread starter #3 Kendel Programmer Apr 24, 2002 1,512 US But if you have the first entry is blank, you wouldn't see it but I think it is focused. <form name="test1" method="POST" > <SELECT id=select1 name=select1> <OPTION> </OPTION> <OPTION> 1</OPTION> <OPTION> 2</OPTION> </SELECT> Upvote 0 Downvote
But if you have the first entry is blank, you wouldn't see it but I think it is focused. <form name="test1" method="POST" > <SELECT id=select1 name=select1> <OPTION> </OPTION> <OPTION> 1</OPTION> <OPTION> 2</OPTION> </SELECT>
Nov 10, 2003 Thread starter #4 Kendel Programmer Apr 24, 2002 1,512 US Thanks LakshmiKiran. Upvote 0 Downvote