frame1.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <!DOCTYPE html>
  2. <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
  3. <head>
  4. <th:block th:include="include :: header('多层窗口A')" />
  5. </head>
  6. <body class="gray-bg">
  7. <div class="container-div">
  8. <div class="row">
  9. <form id="form-user-add" class="form-horizontal">
  10. <div class="row">
  11. <div class="col-sm-12" style="margin-top: 50px">
  12. <div class="form-group">
  13. <label class="col-sm-4 control-label">用户名称:</label>
  14. <div class="col-sm-4">
  15. <input id="name" placeholder="请输入用户名称" class="form-control" type="text">
  16. </div>
  17. <button type="button" class="btn btn-primary" onclick="selectUserToParentId()">选择</button>
  18. </div>
  19. </div>
  20. </div>
  21. </form>
  22. </div>
  23. </div>
  24. <div th:include="include :: footer"></div>
  25. <script th:inline="javascript">
  26. /* 提交 */
  27. function submitHandler() {
  28. var name = $("#name").val();
  29. activeWindow().$('#username').html(name);
  30. $.modal.close();
  31. }
  32. // 根据父窗口ID获取
  33. function selectUserToParentId(){
  34. var prefix = ctx + "demo/modal";
  35. var options = {
  36. width: '100px',
  37. height: '100px',
  38. title: '多层窗口B',
  39. url: prefix + "/frame2",
  40. callBack: doSubmit
  41. };
  42. $.modal.openOptions(options);
  43. }
  44. function doSubmit(index, layero){
  45. var body = $.modal.getChildFrame(index);
  46. $("#name").val(body.find('#name').val());
  47. $.modal.close(index);
  48. }
  49. </script>
  50. </body>
  51. </html>