Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.31 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="ISO-8859-1">
  5. <title>Comment Details</title>
  6.  
  7. <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
  8.  
  9. <script type="text/javascript">
  10. $(window).unload(function() {
  11. if (childWindow && !childWindow.closed) {
  12. childWindow.close();
  13. }
  14.  
  15. });
  16.  
  17. function focusChildWindowPopup() {
  18. if (childWindow && !childWindow.closed) {
  19. childWindow.focus();
  20. }
  21. }
  22.  
  23. $(document)
  24. .ready(
  25. function() {
  26.  
  27. $("#ducMaximizeId")
  28. .click(
  29. function(event) {
  30. event.preventDefault();
  31. childWindow = window
  32. .open(
  33. "./child.html",
  34. "ChildWindow",
  35. "width=800,height=500,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,top=100,left=300");
  36.  
  37. document.onmousedown = focusChildWindowPopup;
  38. document.onkeyup = focusChildWindowPopup;
  39. document.onmousemove = focusChildWindowPopup;
  40. childWindow.focus();
  41. return false;
  42. });
  43. });
  44. </script>
  45.  
  46. </head>
  47. <body>
  48. <form>
  49. <table>
  50.  
  51. <tr>
  52. <td>Enter Number</td>
  53. <td><input type="text" name="number"></td>
  54. </tr>
  55.  
  56. <tr>
  57. <td>Enter first name</td>
  58. <td><input type="text" name="firstName" id="firstNameId"></td>
  59. </tr>
  60.  
  61. <tr>
  62. <td>Enter Last name</td>
  63. <td><input type="text" name="lastName" id="lastNameId"></td>
  64. </tr>
  65.  
  66. <tr>
  67. <td colspan="2"><input type="button" id="ducMaximizeId"
  68. value="OpenWindow"></td>
  69.  
  70. </tr>
  71. </table>
  72.  
  73. </form>
  74. </body>
  75. </html>
  76.  
  77. <!DOCTYPE html>
  78. <html>
  79. <head>
  80. <meta charset="ISO-8859-1">
  81. <title>Comment Details</title>
  82.  
  83. <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
  84.  
  85. <script type="text/javascript">
  86. $(document).ready(function() {
  87.  
  88. alert('child window is opened.')
  89.  
  90. $('#closeId').click(function() {
  91.  
  92. window.opener.$("#firstNameId").val($("#firstNameId").val());
  93. window.opener.$("#lastNameId").val($("#lastNameId").val());
  94. window.close();
  95.  
  96. });
  97. });
  98. </script>
  99.  
  100. </head>
  101. <body>
  102. <form>
  103.  
  104. <table>
  105.  
  106. <tr>
  107. <td>Enter first name</td>
  108. <td><input type="text" name="firstName" id="firstNameId"></td>
  109. </tr>
  110.  
  111. <tr>
  112. <td>Enter Last name</td>
  113. <td><input type="text" name="lastName" id="lastNameId"></td>
  114. </tr>
  115.  
  116. <tr>
  117. <td colspan="2"><input type="button" id="closeId" value="Close" /></td>
  118.  
  119. </tr>
  120. </table>
  121.  
  122.  
  123.  
  124. </form>
  125. </body>
  126. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement