日志文章

2007年12月21日 15:12:12

asp.net+js典型的父子窗口传值用

<base target="_self">
</base>

<script language="javascript">


function openwin(){
a=window.showModalDialog('Default2.aspx?param=ReturnValue');//打开模态对话框,变量a接收返回值
document.form1.TextBox1.value=a[1];//将返回值绑定到TextBox1控件
document.form1.TextBox2.value=a[0];//将返回值绑定到TextBox1控件

//document.forms[0].submit();//刷新页面
}
</script>

protected void Page_Load(object sender, EventArgs e)
{
this.Button1.Attributes["onclick"] = "openwin()";

}



<script language="javascript">
function ReturnValue(PamA,PamB)
{
var my_array = new Array(PamA,PamB);
window.returnValue = my_array;
window.close();
}

</script>

if (!IsPostBack)
{
string ValueA = "ValueA";
string ValueB = "ValueB";
this.Button1.Attributes["onclick"] = "ReturnValue('" + ValueA + "','" + ValueB + "')";
}

类别: 无分类 |  评论(1) |  浏览(2533) |  收藏
发表评论