子页面向父页面传值

想用jquery实现这样一个功能:例如当father页面的一个文本框(txtEmployee)输入控件获得焦点的时候。
弹出一个子页面child.aspx:
child页面中放的是一个repeater控件绑定的Employee表中的数据,
双击repeater控件某一行的时候,将这行数据的Name值返回到
father页面的txtEmployee文本框中。同时关闭child页面。

代码如下:father.aspx
<head runat="server">
<title>无标题页</title>

<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#txtEmployeeID").focus(function() {
parent.openDialog("child", "?page=father&custName=txtEmployee");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="txtEmployee" runat="server"></asp:TextBox>
</div>
</form>


/
child.aspx绑定repeater主要代码

<div class="rept" style="width: 530px; height: 268px;">
<table cellpadding="0" cellspacing="0">
<tr id="0">
<th style="width: 10%">员工编号</th>
<th style="width: 10%">员工所属部门</th>
<th style="width: 9%">姓名</th>
<th style="width: 9%">职务</th>
<th style="width: 9%"> 性别</th>
</tr>
<asp:Repeater ID="reptE" runat="server">
<ItemTemplate>
<tr id="<%# Eval("Employee_ID") %>" title='<%# Eval("Name") %>'>
<td><%#Eval("Employee_ID")%></td>
<td><%#Eval("Dept_ID")%></td>
<td><%#Eval("Name")%></td>
<td><%#Eval("Duty")%></td>
<td><%#Eval("Gender")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>


现在问题:1、在father页面中txtEmployee获得焦点的时候不弹出子页面。
2、在子页面中双击repeater某行的时候如何获取到相应的Name值。 提问者: bogeyman0 - 二级
最佳答案
1. parent.openDialog("child", "?page=father&custName=txtEmployee");
问号前面具体的页面写上不就行了。
或者直接用window.open()不也行吗


2.写一个函数:
function quzhi(obj)
{
var name=$("#" + obj.id + " td").eq(2).text();
return name;
}
这就是取得name的值,obj是传入一个tr

转自:http://zhidao.baidu.com/question/129542051.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值