Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2005
    Posts
    61
    Thanks
    12
    Thanked 0 Times in 0 Posts

    on focus after search

    Hello,

    I have a search textbox field which populates the results in a dropdown after searched.

    But there is no way, to let users to explain to click or use the dropdown to see the results.. thus, I would like to have a focus on the dropdown, so after the user searches through the search textfield, and enter, the dropdown gets the focus so it will user friendly.

    can anyone help me on this.
    thank you in advance

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,300
    Thanks
    203
    Thanked 2,561 Times in 2,539 Posts
    Is this what you are seeking?


    Code:
    <script type="text/javascript">
    function selSelect(which) {
    document.forms[0].mySelectBox.selectedIndex = which;
    }
    </script>
    The first index of the select list is of course 0, and if you always want that you can hard code it.

    Code:
    <script type="text/javascript">
    function selSelect() {
    document.forms[0].mySelectBox.selectedIndex = 0;
    }
    </script>
    Quizmaster: What "G" is the national dish of Hungary?
    Contestant: Goats

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New Coder
    Join Date
    Oct 2005
    Posts
    61
    Thanks
    12
    Thanked 0 Times in 0 Posts
    im not sure, the dropdown i have

    <asp:dropdownlist id="cmbpart" runat="server" datatextfield="number" datavaluefield="partnumber" Cssclass="label"></asp:dropdownlist>

    and i get the values of dropdown from a search textfield results.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •