日期:2014-05-18  浏览次数:20437 次

一个向父窗体传值的简单问题
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();
}