I an trying to pass values from the pop-up window to Java Bean and close the window. What happens is either values are passed JBeans but the window remains open, either I close the pop-up window and values are not passed. Can anyone help me make this work. Parent and child windows use the same JBean
Parent code:
<script type="text/javascript">
child_open = function () {
var m = document.getElementById('clickForm');
m.style.display = 'block';
m.onclick = refocus;
m.data = data;
m.submit();
};
</script>
...
<FORM ID="clickForm" METHOD=POST action="child.jsp" target="TheWindow">
...
<br> <INPUT TYPE=SUBMIT VALUE="Submit" onclick="child_open()"> <br>
</FORM>
Child Code (Pop-up Window)
<script type="text/javascript">
closeChild = function ()
{
window.opener.location.reload();
// if I close it, then data is no passed to beans
// if I leave it open, then data is passed
window.close();
}
</script>
...
<FORM ID="clickForm" METHOD="POST">
<br>
<DIV ALIGN="left">
<INPUT TYPE="submit" VALUE="Done!" onclick="closeChild()" formtarget="_parent"/>
</DIV>
...
</FORM>
Try looking at local storage . Presuming the parent and child are from the same domain, they can see the common data store. The child captures what you need and persists to the local storage. The parent would then read storage to get the value.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.