javascript子窗口传值给父窗口
if (this.ListInfoClass.SelectedIndex >= 0)
{
if (Request.QueryString["TextID"] != null)
{
string strScript = "<script>" + "\r\n";
strScript += "window.opener.document.form1['" + Request.QueryString["TextID"].ToString() + "'].value='" + this.ListInfoClass .SelectedItem.Text + "'" + "\r\n";
strScript += "window.parent.close();" + "\r\n";
strScript += "</script>" + "\r\n";
if ((!(IsClientScriptBlockRegistered("clientScript"))))
{
RegisterClientScriptBlock("clientScript", strScript);
}
}
}
else
{
Response.Write("<script language='javascript'>alert('请选择一个类别');</script>");
}
{
if (Request.QueryString["TextID"] != null)
{
string strScript = "<script>" + "\r\n";
strScript += "window.opener.document.form1['" + Request.QueryString["TextID"].ToString() + "'].value='" + this.ListInfoClass .SelectedItem.Text + "'" + "\r\n";
strScript += "window.parent.close();" + "\r\n";
strScript += "</script>" + "\r\n";
if ((!(IsClientScriptBlockRegistered("clientScript"))))
{
RegisterClientScriptBlock("clientScript", strScript);
}
}
}
else
{
Response.Write("<script language='javascript'>alert('请选择一个类别');</script>");
}