473,246 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 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 3167
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

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

Similar topics

2
by: Seth E Seligman | last post by:
I'm working on a web based file manager. The rename file function creates a new window with a form allowing the user to enter a new file name. Before the form gets submitted, I want to make sure that...
1
by: Joe D | last post by:
I think this is a simple question. But I am new to JS. Here is what I want to do: From a parent window, open a popup window (child) to get data from user, then user submit the request, close the...
11
by: JSjones | last post by:
when a form is submitted from the main window i want a pop up window to open from the onclick event. i have that working, now how can i close the pop up window from the main window after the main...
4
by: ...D. | last post by:
OK. I am halfway decent with HTML. Now I want to try javascript for some things that HTML cannot do. I have looked over a tutorial & all. What I want to do is create a button, that when...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
5
by: Steve | last post by:
Hi, I currently have a problem passing a variable value from one page to another. Once a form submit button is pressed java pops up a window and displays some information. The problem being is...
9
by: Stan B | last post by:
I create a popup window by calling window.showModalDialog Popup window has Ok button with this code attached: === string Script = "<script language=JavaScript>" + "{" + "window.close();" +...
4
by: Gabriella | last post by:
Hi, I have a popup window that opens from a page on my website. This popup is a form with several fields. Upon submit button it redirects to a server side ASP page which writes all data to the...
1
by: sjsean | last post by:
In an asp page I have the following scenario happening (or would like to happen) person picks a menu item in main page which opens a popup window that allows customization of that menu item. ...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.