test_Box.html 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <!--<!DOCTYPE html>-->
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <script src="../../lib/jquery/jquery-3.2.1.min.js"></script>
  6. <link rel="stylesheet" href="../../lib/bootstrap/css/bootstrap.min.css">
  7. <script src="../../lib/bootstrap/bootstrap.min.js"></script>
  8. <script src="../../public/web/PerfectLoad.js"></script>
  9. </head>
  10. <body>
  11. <button id = "btnA">按钮A</button>
  12. <button id = "btnB">按钮B</button>
  13. <button id = "btnC">按钮C</button>
  14. <button id = "btnD">按钮D</button>
  15. <script>
  16. !function loadHintBox(){
  17. $("body").append('<div id = "hintBox_container"></div>');
  18. $("#hintBox_container").load("../../public/scHintBox.html");
  19. }();
  20. $(document).ready(function(){
  21. function cbYes() {alert('你点击了yes按键');};
  22. function cbNo() {alert('你点击了no按键');}
  23. $("#btnA").click(function(){
  24. let s = hintBox.font('5');
  25. hintBox.infoBox('系统提示', `该行已被第 ${s} 行引用,不允许删除!`, 1);
  26. });
  27. $("#btnB").click(function(){
  28. hintBox.infoBox('操作确认', '确定要删除当前节点吗?', 2, cbYes);
  29. // 或: hintBox.infoBox('操作确认', '确定要删除当前节点吗?', 2, cbYes, cbNo);
  30. });
  31. $("#btnC").click(function(){
  32. hintBox.infoBox('多分支选择', '三个按钮是否继续?', 3, cbYes, cbNo);
  33. // 或: hintBox.infoBox('多分支选择', '三个按钮是否继续?', 3, cbYes, undefined, ['你','我','他']);
  34. });
  35. $("#btnD").click(function(){
  36. hintBox.valueBox('请输入新名称:', '111', function () {
  37. let newName = hintBox.value;
  38. if (newName == '') {
  39. hintBox.error('名称不能为空!');
  40. return false;
  41. };
  42. if (newName == '111') {
  43. hintBox.error(`“${newName}” 已存在,请重新输入!`);
  44. return false;
  45. };
  46. });
  47. });
  48. });
  49. </script>
  50. </body>
  51. </html>