comboBoxCase001.htm 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title></title>
  5. <link href="../../lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
  6. <style type="text/css">
  7. </style>
  8. <script src="../../lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
  9. <script src="../../lib/ligerUI/js/core/base.js" type="text/javascript"></script>
  10. <script src="../../lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
  11. <script src="../../lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
  12. <script src="../../lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
  13. <script type="text/javascript">
  14. $(function ()
  15. {
  16. var proData =
  17. [{ id: 1, text: '广东' },
  18. { id: 2, text: '福建'}];
  19. var cityData =
  20. [{ id: 1, text: '潮州', pid: 1 },
  21. { id: 2, text: '福州', pid: 1 },
  22. { id: 3, text: '广州', pid: 2 },
  23. { id: 4, text: '厦门', pid: 2}];
  24. $("#txtPro").ligerComboBox({ data: proData, isMultiSelect: false,
  25. onSelected: function (newvalue)
  26. {
  27. var newData = new Array();
  28. for (i = 0; i < cityData.length; i++)
  29. {
  30. if (cityData[i].pid == newvalue)
  31. {
  32. newData.push(cityData[i]);
  33. }
  34. }
  35. $("#txtCity").ligerGetComboBoxManager().setData(newData);
  36. }
  37. });
  38. $("#txtCity").ligerComboBox({ data: null, isMultiSelect: true, isShowCheckBox: true });
  39. });
  40. </script>
  41. </head>
  42. <body style="padding:10px">
  43. <h3>联动效果</h3>
  44. <input type="text" id="txtPro"/>
  45. <br />
  46. <input type="text" id="txtCity"/>
  47. <br />
  48. <div style="display:none;">
  49. </div>
  50. </body>
  51. </html>