If the page in the modal window has the submit button, a new page will pop up after you click it.
There are two ways to solve this problem:
1,In the head, add <base target = "_ self">;
2,Make the pop-up window page into a frame webpage to load the webpage to be displayed;
Below is an example of the first solution.
(1)Create an htm file
SelectFilterCondition.htm
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
<Html>
<Head>
<Title> select... </Title>
<Meta name = "GENERATOR" content = "Microsoft Visual Studio. NET 7.1">
<Meta name = "ProgId" content = "VisualStudio. HTML">
<Meta name = "Originator" content = "Microsoft Visual Studio. NET 7.1">
<Meta http-equiv = "Pragma" content = "no-cache">
<Meta http-equiv = "no-cache">
<Meta http-equiv = "Expires" content = "-1">
<Meta http-equiv = "Cache-Control" content = "no-cache">
<Base target = "_ self"/>
<Script language = "javascript">
Function Load (){
Window. Code. location. href = 'selectfiltercondition. aspx '+ window. location. search;
}
</Script>
</Head>
<Body topmargin = 0 bottommargin = 0 leftmargin = 0 rightmargin = 0 onload = "Load ()">
<Table width = 100% height = 100% border = 0 cellpadding = 0 cellspacing = 0>
<Tr>
<Td>
<Iframe id = Code name = Code frameborder = 0 height = 100% width = 100% scrolling = "no"> </iframe>
</Td>
</Tr>
</Table>
</Body>
</Html>
(2)Call the following JS script
JSCode
Function DoSelect ()
{
Var ht = document. getElementById ("hidText ");
Var hd = document. getElementById ("HidTxtID"). value;
Var cbs = document. getElementsByName ("Sel ");
Ht. value = "";
For (var I = 0; I <cbs. length; I ++)
{
If (cbs [I]. checked = true)
{
Ht. value + = cbs [I]. value + ",";
}
}
Ht. value = (ht. value). substr (0, (ht. value). length-1 );
Window. returnValue = ht. value;
Window. close ();
}
Function OpenTextWin (ID, Filed, TxtID, SearchType)
{
Var url = "SelectFilterCondition.htm? ID = "+ ID +" & Filed = "+ Filed +" & TxtID = "+ TxtID +" & SearchType = "+ SearchType;
Var rv = ShowModalDialog (url, 650,550 );
If (rv! = Null & rv. length> 0)
{
If (TxtID! = Null)
{
TxtID. value = rv; // display value
}
}
}
(3)Call JSCode based on parameters on the Usage page
For example, add code on the Usage page:
<INPUT name = 'fc03 _ AB0111 'size = "12" type = "text" id = 't4'/>
<Input type = 'button 'name = 'submit 'value = '... 'Onclick = "OpenTextWin ('308236ed-4aa3-4fc4-8ce6-7abef9403a9f', 'fc03 _ ab0111', $('t4 '), 'search')"/>
Add code on the pop-up page:
<INPUT onclick = "DoSelect ()" type = "button" value = "Confirm">
After completing the preceding steps, the new window pops up when the modal window is submitted. A practical modal window with query will be displayed in front of you!
(4)Paste an image of the instance for your reference.
For more information about showModalDialog, see: http://www.cnblogs.com/xiaotao823/archive/2009/02/05/1384836.html