关于jquery和子页面向父页面传值
来源:互联网 发布:mac用什么杀毒软件 编辑:程序博客网 时间:2024/05/22 03:49
原文转自:http://zhidao.baidu.com/question/129542051.html
关于jquery和子页面向父页面传值
刚接触jquery遇到问题了。想用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值。
最佳答案
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
0 0
- 关于jquery和子页面向父页面传值
- 子页面向父页面传值
- 子页面向父页面传值
- 子页面向父页面传值
- 子页面向父页面传值
- window.open 通过子页面向父页面传值
- window.open 父页面向子页面传值
- ligerui父页面向子页面传值
- 关于iframe向父页面传值
- jquery ligerUI子父页面传值
- 使用LAYUI父页面向子页面传参
- js子页面向父页面插入值
- window.showModalDialog子页面向父页面返回值
- 使用iframe,父页面和子页面jquery冲突
- js父页面和子页面之间传值
- 父页面向子页面传值的问题 纯js实现 不拼url传参
- 关于子页面与父页面的关闭和弹出
- JQuery 关闭子页面,刷新父页面
- github的注册及登陆后信息的设置
- Codeforces Round #279 (Div. 2) B. Queue(链表)
- oracle用户,权限,表空间管理
- document.execCommand 常用的方法.
- LeetCode -- Search in Rotated Sorted Array II
- 关于jquery和子页面向父页面传值
- 分解质因数
- 自定义TextView
- You can ignore those files in your build.gradle
- SQLite使用技巧
- github常见操作和常见错误!错误提示:fatal: remote origin already exists.
- jQuery学习之prop和attr的区别示例介绍
- 软考——多媒体
- 结构体数组,平均成绩,指针的三种表示方法