checkboxlist 下拉框多选功能 ,模拟dropdownlist带复选框效果
2016-11-10 14:28
525 查看
前台代码
01.<html xmlns="http://www.w3.org/1999/xhtml"> 02.<head runat="server"> 03. <title>下拉框实现多选</title> 04. <script src="Jquery-1.8.3.min.js" type="text/javascript"></script> 05. <script type="text/javascript"> 06. /* 07. * 08. * 09. */ 10. $(function() { 11. $("#<%=txtList.ClientID %>").mouseenter(function() { 12. $("#divChkList").slideDown("fast"); 13. }); 14. $("#divMulti").mouseleave(function() { 15. $("#divChkList").slideUp("fast"); 16. }); 17. $("#divChkList :checkbox").each(function() { 18. $(this).click(function() { 19. var $txtList = $("#<%=txtList.ClientID %>"); 20. if (this.checked) { 21. $txtList.val($txtList.val() + $(this).next().text()+","); 22. } 23. else { 24. $txtList.val($txtList[0].value.replace($(this).next().text()+',','')); 25. } 26. }); 27. }); 28. }); 29. </script> 30. 31.</head> 32.<body> 33. <form id="form1" runat="server"> 34. <input type="checkbox" id="test" value="1" title="d" /> 35. <div style="width:400px;height:300px;margin:0 auto;"> 36. <div id="divMulti"> 37. <asp:TextBox ID="txtList" runat="server" Width="100px"></asp:TextBox> 38. <div id="divChkList" style="display: none; border: solid 1px #CCCCCC; position: fixed; 39. z-index: 100; height: 160px; width: 100px; overflow-y: scroll; background-color: White"> 40. <asp:CheckBoxList ID="chkList" runat="server" RepeatLayout="Table" RepeatDirection="Vertical"> <asp:ListItem Value="12036">(12036)汉庭星空酒店管理有限公司</asp:ListItem> <asp:ListItem Value="12036">(12036)汉庭星空酒店管理有限公司</asp:ListItem> <asp:ListItem Value="12036">(12036)汉庭星空酒店管理有限公司</asp:ListItem> <asp:ListItem Value="12036">(12036)汉庭星空酒店管理有限公司</asp:ListItem> <asp:ListItem Value="12036">(12036)汉庭星空酒店管理有限公司</asp:ListItem> <asp:ListItem Value="12036">(12036)汉庭星空酒店管理有限公司</asp:ListItem> 41. </asp:CheckBoxList> 42. </div> 43. </div> 44. </div> 45. </form> 46.</body> 47.</html>
相关文章推荐
- 模拟QQ分组(具有伸缩功能) (添加开源框架的光闪烁效果)SimpleExpandableListAdapter 适配器的用法,并且可添加组及其组内数据。
- ASP.NET中 RadioButtonList(单选按钮组),CheckBoxList(复选框组),DropDownList(下拉框),ListBox(列表框),BulletedList(无序列表)的使用前台绑定
- 20151224:Web:CheckBoxList 控件:去重显示 ;复选框多选时可点击查询查出结果
- ListFragment+CheckedTextView和ListFragment+CheckBox两种多选效果
- (webapp)微信和safri 对于html5 部分功能不兼容,多选或单选下拉框去除边框无效果。
- CListCtrl控件实现点击单行选中当前CheckBox点击CheckBox实现多选功能
- 使用Jquery X-Menu 插件实现多选checkbox控件的功能
- 方便实用的jQuery checkbox复选框全选功能简单实例
- checkbox设置复选框的只读效果
- CheckBoxList 和 DropDownList 的二级联动
- BaseAdapter完美实现ListView中checkbox全选,取消,多选功能
- 基于ListView和CheckBox实现多选和全选记录的功能
- ExtJs Treepanel节点checkbox的半选中状态复选框效果
- CheckBoxList多选样式jquery、C#获取选择项
- 《黑马程序员》 LinkedList之堆栈和队列功能的模拟
- DropDownList实现多选功能
- ANDROID GRIDVIEW仿微信图片多选功能_显示本地相册图片多选效果
- JS复选框向一个文本框中传值的多选效果
- html checkbox多选复选框form控件元素
- 利用LinkedList容器模拟栈效果