读书人

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

发布时间: 2012-02-03 22:02:47 作者: rapoo

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

读书人网 >asp.net

热点推荐