How to close the popup window when submitting the form?
I have a sample.jsp. In that page one button is there.
when button pressed, open popup window contains one “text box” and one ” submit button”. when “submit” button pressed, call the “servlet” in this popup window and then close the “popup” window.
<SCRIPT LANGUAGE=”JavaScript”>
<!– Begin
var X = 200; // change the # at the left for a fixed X co-ordinate to accommodate browsers other than IE or NS
var Y = 200; // change the # at the left for a fixed Y co-ordinate to accommodate browsers other than IE or NS
if (navigator.appName.indexOf(“Netscape”)!=-1) {
document.captureEvents(Event.MOUSEMOVE)
function getcoords(e) {
X = parseInt(e.screenX) – 80; // change the # at the left to further adjust the left-margin depending on the size of the window
Y = parseInt(e.screenY) – 60; // change the # at the left to further adjust the top-margin depending on the size of the window
return true;}
document.onmousemove = getcoords;
function openWin() {
if (navigator.appName.indexOf(“Microsoft”)!=-1) {
X = parseInt(event.screenX) – 80; // change the # at the left to further adjust the left-margin depending on the size of the window
Y = parseInt(event.screenY) – 60; } // change the # at the left to further adjust the top-margin depending on the size of the window
display=window.open(”,’NewWin’,’menubar=0,location=no,status=no,directories=no,toolbar=no,scrollbars=yes,height=30,width=230′)
message=”<font face=’verdana, arial, helvetica, san-serif’ size=’2′>”;
message+=”<form name=’form1′ action=’./SaveFile’>”;
message+=”Enter Query Name:”;
message+=”<input type=’text’ name=’query_name’ />”;
message+=”<input type=’submit’ value=’GO’/>”;
message+=”</form></font>”;
display.moveTo(X,Y);
display.document.write(message); }
}
// End –>
</script>
The above code calls the “servlet” but didn’t cose the popup window.
modify the above code with below code
message+=”<input type=’submit’ value=’GO’ onClick=’window.close()’/>”;
then when submit button pressed in popupwindow that window will be closed but didn’t call the servlet.
plz help me, how to close the popup window after submitting the form in popupwindow.