By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,825 Members | 1,281 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,825 IT Pros & Developers. It's quick & easy.

How to close the popup window when submitting the form?

P: 2
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.

Expand|Select|Wrap|Line Numbers
  1. <SCRIPT LANGUAGE="JavaScript">
  2.  
  3. <!-- Begin
  4.  
  5. var X = 200; // change the # at the left for a fixed X co-ordinate to accommodate browsers other than IE or NS
  6.  
  7. var Y = 200; // change the # at the left for a fixed Y co-ordinate to accommodate browsers other than IE or NS
  8.  
  9.  
  10. if (navigator.appName.indexOf("Netscape")!=-1) {
  11.  
  12. document.captureEvents(Event.MOUSEMOVE)
  13.  
  14. function getcoords(e) {
  15.  
  16. X = parseInt(e.screenX) - 80; // change the # at the left to further adjust the left-margin depending on the size of the window
  17.  
  18. Y = parseInt(e.screenY) - 60; // change the # at the left to further adjust the top-margin depending on the size of the window
  19.  
  20. return true;}
  21.  
  22. document.onmousemove = getcoords;
  23.  
  24.  
  25. function openWin() {
  26.  
  27. if (navigator.appName.indexOf("Microsoft")!=-1) {
  28.  
  29. X = parseInt(event.screenX) - 80; // change the # at the left to further adjust the left-margin depending on the size of the window
  30.  
  31. Y = parseInt(event.screenY) - 60; } // change the # at the left to further adjust the top-margin depending on the size of the window
  32.  
  33. display=window.open('','NewWin','menubar=0,location=no,status=no,directories=no,toolbar=no,scrollbar s=yes,height=30,width=230')
  34.  
  35. message="<font face='verdana, arial, helvetica, san-serif' size='2'>";
  36.  
  37. message+="<form name='form1' action='./SaveFile' onsubmit='form1.submit(); self.close();' >"; 
  38.  
  39. message+="Enter Query Name:";
  40.  
  41. message+="<input type='text' name='query_name' />";
  42.  
  43. message+="<input type='submit' value='GO'/>";
  44.  
  45. message+="</form></font>";
  46.  
  47. display.moveTo(X,Y);
  48.  
  49. display.document.write(message); }
  50.  
  51. }
  52.  
  53. // End -->
  54.  
  55. </script>


The above code didn't call the "servlet" but cose the popup window.

I want to call the "servlet" and then close the popup window.

plz help me, how to close the popup window after submitting the form in popupwindow.
Aug 28 '08 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
Close the window on the action page.

PS. some of your code is notoriously old. You should probably upgrade some of that code to work with modern browsers.
Aug 28 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.