当前位置: 代码迷 >> ASP.NET >> 一个向父窗体传值的简单有关问题
  详细解决方案

一个向父窗体传值的简单有关问题

热度:1598   发布时间:2013-02-25 00:00:00.0
一个向父窗体传值的简单问题
Response.Write( " <script   language=javascript> ")
                Response.Write( "window.opener.document.Form1.Image1.ImageUrl= ' "   &   FileUrl.ToString()   &   " '; ")
                Response.Write( "window.opener.document.Form1.TextBox18.Text= ' "   &   FileUrl.ToString()   &   " '; ")
                Response.Write( "window.opener.document.Form1.TextBox18.value= ' "   &   FileUrl.ToString()   &   " '; ")
                Response.Write( "window.close(); ")
                Response.Write( " </script> ")

我是这样写的.在这个代码后父窗体中的TextBox18可以得到值,可Image1就是不显示所对应的图片,有什么办法解决吗?

------解决方案--------------------------------------------------------
用Js弄
1.
string Url = " <a href= '# ' onclick=getImageName( ' " + imgName + " ', ' " + userId + " ')> 请点击确保上传成功! </a> ";
lbUrl.Visible = true;
lbUrl.Text = Url;
2.
function getImageName(t,c)
{
window.opener.document.getElementById( "imgName ").value=t;
window.opener.document.getElementById( "Image ").src= "/Picture/ "+c+ "/ "+t;
window.close();
}
  相关解决方案