09 April 2009
0 JavaScript code to refresh the parent window on clicking of a button in a popup opened from the parent window
Here is the JavaScript code to refresh the parent window on clicking of a button in a popup opened from the parent window. The same popup could be created by different parent windows. On clicking of the button in the popup the corresponding parent window should be refreshed.
The refresh function should be in the corresponding parent windows JavaScript. Instead of var i = “/ShowInbox.do”; give the path of the corresponding parent window. Return 0 if the parent window need not be refreshed.
// for parent page refresh after clicking ok in a popup // this function should be in the corresponding parent windows script function refresh(){ var i="/ShowInbox.do"; return i; } //for reload of the opener of the confirmation // this function should be in the pop-up’s JavaScript function confirm() { var contextPath=document.getElementById("context").value; var i=window.opener.refresh(); if (i==0){ window.close(); } else{ window.opener.document.forms[0].action=contextPath+i; window.opener.document.forms[0].submit(); window.close(); } } |
0 comments:
Please give your valuable comments.