471,623 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,623 software developers and data experts.

How to close the popup window when submitting the form?

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
1 2951
acoder
16,027 Expert Mod 8TB
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.

Similar topics

2 posts views Thread by Seth E Seligman | last post: by
5 posts views Thread by Steve | last post: by
9 posts views Thread by Stan B | last post: by
4 posts views Thread by Gabriella | last post: by
1 post views Thread by sjsean | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.