1

我有一个“DropDownCheckBoxList”用户控件,我在下拉 DIV 中使用文本框、图像(箭头)和隐藏的 ASP.Net CheckBoxList 控件从头开始创建。

结合大量的 JQuery,它运行良好,除了最后一个功能......下拉列表项的键盘向上/向下导航。

它看起来像这样:

在此处输入图像描述

生成的 HTML 示例如下所示:

<div style="width: 170px;" class="dropDownComboxBoxList">
    <div onclick="DropDown('#MainContent_DropDownCheckBoxList1_dropDownDiv', '#MainContent_DropDownCheckBoxList1_dropDownTextBox')" class="dropDownControl" id="MainContent_DropDownCheckBoxList1_dropDownControl">
        <div style="width: 150px;" class="dropDownLeft">
            <input type="text" class="dropDownEdit" id="MainContent_DropDownCheckBoxList1_dropDownTextBox" readonly="readonly" value="Item 0, Item 1" name="ctl00$MainContent$DropDownCheckBoxList1$dropDownTextBox">
        </div>
        <div class="dropDownRight">
            <img src="http://localhost:28071/Images/DropDown_off.gif" class="dropDownImg img-swap" id="MainContent_DropDownCheckBoxList1_dropDownImage">
        </div>
    </div>
    <div style="width: 300px; max-height: 300px; margin-top: 0px; display: none;" class="dropDownDiv" id="MainContent_DropDownCheckBoxList1_dropDownDiv">
        <table style="height: 40px; width: 290px;" class="checkBoxList dropDownTable" id="MainContent_DropDownCheckBoxList1_checkBoxList">
            <tbody>
                <tr class="checkSel">
                    <td><input type="checkbox" value="0" checked="checked" id="MainContent_DropDownCheckBoxList1_checkBoxList_0" class="dropDownCheck"><label for="MainContent_DropDownCheckBoxList1_checkBoxList_0" class="dropDownLabel">Item 0</label></td>
                </tr>
                <tr class="checkSel">
                    <td><input type="checkbox" value="1" checked="checked" id="MainContent_DropDownCheckBoxList1_checkBoxList_1" class="dropDownCheck"><label for="MainContent_DropDownCheckBoxList1_checkBoxList_1" class="dropDownLabel">Item 1</label></td>
                </tr>
                <tr>
                    <td><input type="checkbox" value="2" id="MainContent_DropDownCheckBoxList1_checkBoxList_2" class="dropDownCheck"><label for="MainContent_DropDownCheckBoxList1_checkBoxList_2" class="dropDownLabel">Item 2</label></td>
                </tr>
                <tr>
                    <td><input type="checkbox" value="3" id="MainContent_DropDownCheckBoxList1_checkBoxList_3" class="dropDownCheck"><label for="MainContent_DropDownCheckBoxList1_checkBoxList_3" class="dropDownLabel">Item 3</label></td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

我已经尝试连接到jQuery.keynav,然后连接到jQuery.navigate ,但是虽然两者都捕获按键,但它们对选择没有任何影响,并且上/下键仍然只是滚动下拉列表(当有更多项目时当然,与此示例不同)。

jQuery.navigate 的当前连接对于显示的 HTML 如下所示:

$('#MainContent_DropDownCheckBoxList1_checkBoxList').filter('td').navigate({ mouse: true, activeClass: 'checkHover' });

有什么想法我还需要做些什么才能让它导航?这只是在下拉列表中使用 CheckBoxList 的问题吗?我是否滥用了导航加载项?

4

0 回答 0