我在index.aspx 中用了iframe 内嵌了 b.aspx,如何在b.aspx中点击linkbutton 控制index.aspx 中的一个input内的值?

parsely 2003-08-30 02:17:24
这是我的index.aspx中的一段html代码:

<form id="perfectform1" method="post" runat="server">
<asp:TableCell>
<iframe name="ad" frameborder="0" width="100%" height="30" scrolling="no" src="b.aspx">
</iframe>
</asp:TableCell>
<asp:TableRow AccessKey="Y">
<asp:TableCell ColumnSpan="2">
<input name="oneimg">
</asp:TableCell>
</asp:TableRow>
</form>

我的 b.aspx.cs中的

protected void button_click_upload(Object sender, EventArgs e)
{
Response.Write("<"+"script>parent.perfectform1.oneimg.value+='"+FN+"'</"+"script>");


}

这里的button_click 里的程序是好使的,它能使 index.aspx中名称为oneimg的input值为变量 "FN"的值。但是我同样在 b.aspx.cs中定义了一个linkbutton我想清空oneimg的input值,却为什么不启作用,如下:


private void Page_Load(object sender, System.EventArgs e)
{
LinkButton myLinkButton = new LinkButton(); //实例化一个 linkbutton
myLinkButton.ID = "myLink";
myLinkButton.Text = "清空";
myLinkButton.Visible=false;
myLinkButton.Click += new EventHandler(this.Process);
this.Controls[1].Controls.Add(myLinkButton);

}







private void Process(object sender,EventArgs e)
{
//如何加上清空index.aspx中名称为oneimg的input值

upload_file.Visible=true;
Button1.Visible=true;
((LinkButton)FindControl("myLink")).Visible=false; //让linkbutton不可见

Info.Visible=false;
}

请大家帮我看看应该如何把那段清空的程序加上,非常感谢!!
...全文
48 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
parsely 2003-08-30
  • 打赏
  • 举报
回复
好的,我试试
saucer 2003-08-30
  • 打赏
  • 举报
回复
去掉+号 ^^^^
parsely 2003-08-30
  • 打赏
  • 举报
回复
我把 Response.Write("<"+"script>parent.perfectform1.oneimg.value+=''</"+"script>"); 加上后,只是在原来的oneimg的值的后面加上个空值,没有把原来的值清掉啊!

saucer 2003-08-30
  • 打赏
  • 举报
回复
should be similar, can you check the HTML source in IE to see if

<script>parent.perfectform1.oneimg.value ='' </script>

is created after Process is called?
parsely 2003-08-30
  • 打赏
  • 举报
回复
怎么没人告诉我啊

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧