Connecting Tech Pros Worldwide Help | Site Map
Reply
 
LinkBack Thread Tools Search this Thread
  #1  
Old August 28th, 2008, 06:54 AM
Newbie
 
Join Date: Aug 2008
Posts: 2
Default How to close the popup window when submitting the form?

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.

[HTML]<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,locatio n=no,status=no,directories=no,toolbar=no,scrollbar s=yes,height=30,width=230')



message="<font face='verdana, arial, helvetica, san-serif' size='2'>";


message+="<form name='form1' action='./SaveFile' onsubmit='form1.submit(); self.close();' >";



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>[/HTML]



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.

Last edited by gits; August 28th, 2008 at 08:46 AM. Reason: added code tags
Reply
  #2  
Old August 28th, 2008, 11:30 AM
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 12,964
Default

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.
Reply
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,248 network members.