Comparing tables from parent window and child window

javascript Japan
  • 13 years ago

    Ei guys..its me again..

    just want to ask how will I compare the contents of particular cell of the table(from parent window) to the contents of a cell of the table (child window)? how will I use ID for this?
    I need to compare because If the two contents are the same, no need to add the table (from the child window) to the table on the parent window..

    this is my code

    Child window
    note: cell3 contents will be the basis of comparison

    var tbody = self.opener.document.getElementById("ProgramList").getElementsByTagName("tbody")[0];
    var row = self.opener.document.createElement("TR");
    var cell1 = self.opener.document.createElement("TD");
    var inp1 = self.opener.document.createElement("INPUT");
    inp1.setAttribute("type","checkbox");
    cell1.appendChild(inp1);
    var cell2 = self.opener.document.createElement("TD");
    var inp2 = self.opener.document.createElement("INPUT");
    inp2.setAttribute("type","text"); // for type
    inp2.setAttribute("size","3"); // for size
    inp2.setAttribute("value","3"); // for value
    cell2.appendChild(inp2);
    cell2.appendChild(inp2);
    cell2.appendChild(inp2);
    var cell3 = self.opener.document.createElement("TD");
    cell3.innerHTML = "article009"; //THIS WILL BE COMPARED
    var cell4 = self.opener.document.createElement("TD");
    cell4.innerHTML = "ルパン三世 2nd.シリーズ 第3話";
    var cell5 = self.opener.document.createElement("TD");
    cell5.innerHTML = "都度課金";
    var cell6 = self.opener.document.createElement("TD");
    cell6.innerHTML = "215円";
    var cell7 = self.opener.document.createElement("TD");
    cell7.innerHTML = "2007/5/15";
    var cell8 = self.opener.document.createElement("TD");
    cell8.innerHTML = "2008/5/14";
    var cell9 = self.opener.document.createElement("TD");
    cell9.innerHTML = "2008/5/14";
    var cell10 = self.opener.document.createElement("TD");
    cell10.innerHTML = "2008/5/14";
    var cell11 = self.opener.document.createElement("TD");
    cell11.innerHTML = "flet's東";
    row.appendChild(cell1);
    row.appendChild(cell2);
    row.appendChild(cell3);
    row.appendChild(cell4);
    row.appendChild(cell5);
    row.appendChild(cell6);
    row.appendChild(cell7);
    row.appendChild(cell8);
    row.appendChild(cell9);
    row.appendChild(cell10);
    row.appendChild(cell11);
    tbody.appendChild(row);










































    now this is the table from the parent window

    <table id="ProgramList" class="searchList">
    <caption align=left><b>関連付け設定されている商品</b></caption>
    <tr>
    <th>&nbsp;</th>
    <th>表示順</th>
    <th>商品識別子</th>
    <th>商品名</th>
    <th>料金タイプ</th>
    <th>料金</th>
    <th>販売開始</th>
    <th>販売終了</th>
    <th>公開開始</th>
    <th>配信終了</th>
    <th>サイト</th>
    </tr>
    <tr>
    <td><input type="checkbox" name="商品ID1" value="meta_rupin3firstsample-2" checked="checked"/></td>
    <td><input type="text" name="order01" size="3" value="1"></td>
    <td>article005</td> //THIS WILL BE COMPARED
    <td>ルパン三世 2nd.シリーズ 第1話</td>
    <td>都度課金</td>
    <td>515円</td>
    <td>2007/5/15</td>
    <td>2008/5/14</td>
    <td>2007/5/15</td>
    <td>2008/5/14</td>
    <td>gooBB・flet's東</td>
    </tr>
    <tr>
    <td><input type="checkbox" name="商品ID1" value="meta_rupin3firstsample-2" checked="checked"/></td>
    <td><input type="text" name="order01" size="3" value="2"></td>
    <td>article009</td> //THIS WILL BE COMPARED
    <td>ルパン三世 2nd.シリーズ 第2話</td>
    <td>都度課金</td>
    <td>815円</td>
    <td>2007/5/15</td>
    <td>2008/5/14</td>
    <td>2007/5/15</td>
    <td>2008/5/14</td>
    <td>flet's西・flet's東</td>
    </tr>
    </table>








































    Hope you guys could help me...thank you..

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debuggers don't remove bugs. They only show them in slow motion.”