checkbox.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>CheckBox Tree - jQuery EasyUI Demo</title>
  6. <link rel="stylesheet" type="text/css" href="../../themes/default/easyui.css">
  7. <link rel="stylesheet" type="text/css" href="../../themes/icon.css">
  8. <link rel="stylesheet" type="text/css" href="../demo.css">
  9. <script type="text/javascript" src="../../jquery.min.js"></script>
  10. <script type="text/javascript" src="../../jquery.easyui.min.js"></script>
  11. </head>
  12. <body>
  13. <h2>CheckBox Tree</h2>
  14. <p>Tree nodes with check boxes.</p>
  15. <div style="margin:20px 0;">
  16. <a href="#" class="easyui-linkbutton" onclick="getChecked()">GetChecked</a>
  17. </div>
  18. <div style="margin:10px 0">
  19. <input type="checkbox" checked onchange="$('#tt').tree({cascadeCheck:$(this).is(':checked')})">CascadeCheck
  20. <input type="checkbox" onchange="$('#tt').tree({onlyLeafCheck:$(this).is(':checked')})">OnlyLeafCheck
  21. </div>
  22. <div class="easyui-panel" style="padding:5px">
  23. <ul id="tt" class="easyui-tree" data-options="url:'tree_data1.json',method:'get',animate:true,checkbox:true"></ul>
  24. </div>
  25. <script type="text/javascript">
  26. function getChecked(){
  27. var nodes = $('#tt').tree('getChecked');
  28. var s = '';
  29. for(var i=0; i<nodes.length; i++){
  30. if (s != '') s += ',';
  31. s += nodes[i].text;
  32. }
  33. alert(s);
  34. }
  35. </script>
  36. </body>
  37. </html>