Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="ISO-8859-1">
- <title>Comment Details</title>
- <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
- <script type="text/javascript">
- $(window).unload(function() {
- if (childWindow && !childWindow.closed) {
- childWindow.close();
- }
- });
- function focusChildWindowPopup() {
- if (childWindow && !childWindow.closed) {
- childWindow.focus();
- }
- }
- $(document)
- .ready(
- function() {
- $("#ducMaximizeId")
- .click(
- function(event) {
- event.preventDefault();
- childWindow = window
- .open(
- "./child.html",
- "ChildWindow",
- "width=800,height=500,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no,top=100,left=300");
- document.onmousedown = focusChildWindowPopup;
- document.onkeyup = focusChildWindowPopup;
- document.onmousemove = focusChildWindowPopup;
- childWindow.focus();
- return false;
- });
- });
- </script>
- </head>
- <body>
- <form>
- <table>
- <tr>
- <td>Enter Number</td>
- <td><input type="text" name="number"></td>
- </tr>
- <tr>
- <td>Enter first name</td>
- <td><input type="text" name="firstName" id="firstNameId"></td>
- </tr>
- <tr>
- <td>Enter Last name</td>
- <td><input type="text" name="lastName" id="lastNameId"></td>
- </tr>
- <tr>
- <td colspan="2"><input type="button" id="ducMaximizeId"
- value="OpenWindow"></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="ISO-8859-1">
- <title>Comment Details</title>
- <script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- alert('child window is opened.')
- $('#closeId').click(function() {
- window.opener.$("#firstNameId").val($("#firstNameId").val());
- window.opener.$("#lastNameId").val($("#lastNameId").val());
- window.close();
- });
- });
- </script>
- </head>
- <body>
- <form>
- <table>
- <tr>
- <td>Enter first name</td>
- <td><input type="text" name="firstName" id="firstNameId"></td>
- </tr>
- <tr>
- <td>Enter Last name</td>
- <td><input type="text" name="lastName" id="lastNameId"></td>
- </tr>
- <tr>
- <td colspan="2"><input type="button" id="closeId" value="Close" /></td>
- </tr>
- </table>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement