A页面弹出窗口(B页面),如何将B页面的TextBox的值传递到A页面,并执行A页面按钮Click事件并输出..

MissingWen 2009-09-22 09:25:27
RT

Thanks

//
...全文
132 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
chen_ya_ping 2009-09-22
  • 打赏
  • 举报
回复
js完全是可以实现的:
父窗口:
<script language="javascript" type="text/javascript">
// <!CDATA[
window.open("_TimeSpan.aspx");
var v;
function Button1_onclick() {
alert(v);
}

// ]]>
</script>

子窗口:
<input id="Text1" type="text" value="123" onfocus="Do()" />
function Do() {
if (window.opener != null) {
window.opener.v = document.getElementById("Text1").value;
window.opener.document.getElementById("Button1").click();
}
}
conanhhy 2009-09-22
  • 打赏
  • 举报
回复
JS是首选方法,也是可以实现你的要求的
pzhuyy 2009-09-22
  • 打赏
  • 举报
回复
modal messagebox
diffmaker 2009-09-22
  • 打赏
  • 举报
回复
这种情况只能用脚本控制
diffmaker 2009-09-22
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 lovely_baby 的回复:]
直接使用session 传值
不就行了
[/Quote]
用Session传值可以,但不会改变A页面文本框中的值
diffmaker 2009-09-22
  • 打赏
  • 举报
回复
window.opener.document.getElementById("textbox1").value=""; 
window.opener.document.getElementById("button1").clcick();


window.opener指的是打开本页面的页面,也就是你的A页面
window.opener.document.getElementById("textbox1")获取A页面ID为textbox1的文本框
window.opener.document.getElementById("textbox1").value=""; 将A页面文本框的值设置为空,你可以设置成你要想的值
window.opener.document.getElementById("button1")获取A页面ID为button1的按钮
window.opener.document.getElementById("button1").clcick();触发A页面的按钮的单击事件
wuyq11 2009-09-22
  • 打赏
  • 举报
回复
a.aspx
var url = "a.aspx?Id=" + id;
var mwidth = "400";
var mheight = "330";
var loc_x, loc_y;
loc_x = parseInt((document.body.clientWidth - mwidth) / 2) + 200;
loc_y = parseInt((document.body.clientHeight - mheight) / 2);
window.open(url, "", "left=" + loc_x + "px,top=" + loc_y + "px,width=" + mwidth + "px,height=" + mheight + "px,resizable=no,scrollbars=yes,status=0");
function A()
{
_dopostback('','');
}
b.aspx
window.opener.document.getElementById("").value="";
window.opener.A();
xzq686 2009-09-22
  • 打赏
  • 举报
回复
a.htm:

<script>
function OpenWin()
{
window.open("b.htm");
}
function checkForm()
{
alert("点了A页面的button");
return true;
}
</script>
<form name="form1" onsubmit="return checkForm();">
<input type="button" value="打开新页面" onclick="OpenWin();">
<input type="text" value="" id="tb" name="tb">
<input type="submit" value="要执行的BUTTON" id="btn" name="btn">

</form>

b.htm:

<script>
function TranValue()
{
window.opener.document.getElementById("tb").value=document.getElementById("tb1").value;
window.opener.document.getElementById("btn").click();
window.close();
}
</script>
<input type="button" value="传值回A页面并执行A的CLICK事件" onclick="TranValue();">
<input type="text" value="123123123123" id="tb1" name="tb1">
Lovely_baby 2009-09-22
  • 打赏
  • 举报
回复
直接使用session 传值
不就行了
MissingWen 2009-09-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 wuyq11 的回复:]
window.opener.document.getElementById("textbox1").value="";
window.opener.document.getElementById("button1").Clcick();
[/Quote]

可以详细点吗....在A页面怎么接收textbo1的值.?
wuyq11 2009-09-22
  • 打赏
  • 举报
回复
window.opener.document.getElementById("textbox1").value="";
window.opener.document.getElementById("button1").Clcick();
zhouyanfss 2009-09-22
  • 打赏
  • 举报
回复
session cookie and so on

62,046

社区成员

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

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

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

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