当前位置: 代码迷 >> ASP.NET >> 父窗口怎么获得模态窗口的返回值
  详细解决方案

父窗口怎么获得模态窗口的返回值

热度:6587   发布时间:2013-02-26 00:00:00.0
父窗口如何获得模态窗口的返回值?
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
<script type= "text/javascript ">
function btnOpen_Click()
{
//document.MainForm.txtValue.value = window.open( "2 ", null, "height=300,width=300,status=no,toolbar=no,menubar=no,location=no ");
document.MainForm.txtValue.value = window.showModalDialog( "2 ");
}
</script>
<form name = "MainForm ">
<input type = "button " value= "Click " name = "btnOpen " onClick= "btnOpen_Click(); " />
<input type = "text " name = "txtValue " />
</form>


2
<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>
  相关解决方案