父窗口如何获得模态窗口的返回值?
private void Button2_Click(object sender, System.EventArgs e)
{
RegisterStartupScript( "key ", " <script> window.returnValue=document.all( 'upFile ').value;window.opener=null;window.close(this); </script> ");
}
父窗口如何获得返回的值呢?
------解决方案--------------------父窗口:
function OpenWindow(Url){
}
------解决方案--------------------var r = window.showModelDialog(...);
alert(r);
------解决方案--------------------请参考
1.html
<script type= "text/javascript ">
function btnOpen_Click()
{
//document.MainForm.txtValue.value = window.open( "2.html ", null, "height=300,width=300,status=no,toolbar=no,menubar=no,location=no ");
document.MainForm.txtValue.value = window.showModalDialog( "2.html ");
}
</script>
<form name = "MainForm ">
<input type = "button " value= "Click " name = "btnOpen " onClick= "btnOpen_Click(); " />
<input type = "text " name = "txtValue " />
</form>
2.html
<script type= "text/javascript ">
function btnOpen_Click()
{
window.returnValue = document.Form1.txtValue.value;
alert (document.Form1.txtValue.value);
window.close();
}
</script>
<form name = "Form1 ">
<input type = "button " value= "Click " name = "btnOpen " onClick= "btnOpen_Click(); " />
<input type = "text " name = "txtValue " />
</form>