1. 程式人生 > >關於jquery和子頁面向父頁面傳值

關於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值。