About Popup window data to Parent window
I am opening one Popup window on Button Click in main window, it is for Image Uploading.
when I am uploading Image , i.e. on Upload button click I am closing this Popup window and opening new Popup window.
And Now I want to display the Popup data to Parent window without refreshing, 开发者_JAVA技巧But I am not getting Parent window object.
i.e. window.opener or window.parent. Please give me help. How I will get Parent window object?
you can try this, When first popup window is opened(uploading image window) get parent window object for this popup and store in some variable(java script variable ) like this var parentWindowObject=window.opener; Try passing this object variable to the second pop up window( on upload click) and in this page you will get it main page window reference (parentWindowObject) and using this you can fire new request to main page to post your required data as follows parentWindowObject.location="your request";
Reason for not using window.opener in second popup As you are opening a new popup from the present popup. The parent for the newpopup will be the popup which you are opening from here is your upload popup and you are closing the upload popup once you click on upload so for the new popup the value for window.opener(a reference for the parent window) will be null.
You can access the parent window by using window.opener
See window.opener
which returns a reference to the window that opened this current window. When a window is opened from another window, it maintains a reference to that first window as window.opener. If the current window has no opener, this method returns NULL.
精彩评论