473,416 Members | 1,498 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,416 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 3183
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.