473,785 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Comparing tables (parent window and child window)

1 New Member
Ei guys..newbie in programming..ju st 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

Expand|Select|Wrap|Line Numbers
  1.         var tbody = self.opener.document.getElementById("ProgramList").getElementsByTagName("tbody")[0]; 
  2.         var row = self.opener.document.createElement("TR"); 
  3.         var cell1 = self.opener.document.createElement("TD"); 
  4.         var inp1 =  self.opener.document.createElement("INPUT"); 
  5.         inp1.setAttribute("type","checkbox"); 
  6.         cell1.appendChild(inp1);
  7.         var cell2 = self.opener.document.createElement("TD"); 
  8.         var inp2 =  self.opener.document.createElement("INPUT"); 
  9.         inp2.setAttribute("type","text");   // for type
  10.         inp2.setAttribute("size","3");      // for size
  11.         inp2.setAttribute("value","3");     // for value
  12.         cell2.appendChild(inp2);
  13.         cell2.appendChild(inp2);
  14.         cell2.appendChild(inp2);
  15.         var cell3 = self.opener.document.createElement("TD"); 
  16.         cell3.innerHTML = "article009";       //THIS WILL BE COMPARED
  17.         var cell4 = self.opener.document.createElement("TD"); 
  18.         cell4.innerHTML = "ルパン三世 2nd.シリーズ 第3話"; 
  19.         var cell5 = self.opener.document.createElement("TD"); 
  20.         cell5.innerHTML = "都度課金"; 
  21.         var cell6 = self.opener.document.createElement("TD"); 
  22.         cell6.innerHTML = "215円"; 
  23.         var cell7 = self.opener.document.createElement("TD"); 
  24.         cell7.innerHTML = "2007/5/15"; 
  25.         var cell8 = self.opener.document.createElement("TD"); 
  26.         cell8.innerHTML = "2008/5/14"; 
  27.         var cell9 = self.opener.document.createElement("TD"); 
  28.         cell9.innerHTML = "2008/5/14"; 
  29.         var cell10 = self.opener.document.createElement("TD"); 
  30.         cell10.innerHTML = "2008/5/14"; 
  31.         var cell11 = self.opener.document.createElement("TD"); 
  32.         cell11.innerHTML = "flet's東"; 
  33.         row.appendChild(cell1); 
  34.         row.appendChild(cell2); 
  35.         row.appendChild(cell3); 
  36.         row.appendChild(cell4); 
  37.         row.appendChild(cell5); 
  38.         row.appendChild(cell6); 
  39.         row.appendChild(cell7); 
  40.         row.appendChild(cell8); 
  41.         row.appendChild(cell9); 
  42.         row.appendChild(cell10); 
  43.         row.appendChild(cell11); 
  44.         tbody.appendChild(row); 
  45.  
now this is the table from the parent window

[HTML] <table id="ProgramList " class="searchLi st">
<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_rup in3firstsample-2" checked="checke d"/></td>
<td><input type="text" name="order01" size="3" value="1"></td>
<td>article00 5</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_rup in3firstsample-2" checked="checke d"/></td>
<td><input type="text" name="order01" size="3" value="2"></td>
<td>article00 9</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西・fle t's東</td>
</tr>
</table>[/HTML]

Hope you guys could help me...thank you..
Jul 12 '07 #1
1 2300
acoder
16,027 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. var table = window.opener.document.getElementById("ProgramList"); // get the table
  2. var rows = table.getElementsByTagName("tr"); // get rows
  3. for (i = 0; i < rows.length; i++) {
  4.   var cells = rows[i].getElementsByTagName("td");
  5.   if (cells.length >= 2) {
  6.     thirdCell = cells[2];
  7.     // compare cells here...
  8.   }
  9. }
Jan 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3824
by: Bostonasian | last post by:
I am trying to append options to dropdown in parent window from option items in child window. In parent window, I have following code: <script language="javascript"> function AddItem2DropDown(item){ exists = false; for(d=0;d<drpDwn.length;d++){ if(drpDwn.options.value == item.value)
4
22212
by: Davey | last post by:
I have a website which has a popup window (this only opens when the user chooses to open it). In the popup window I have a <select> control which lists a selection of "classes". Each class has a description and a class_id (stored in the value attribute of each option). The user will then select a class from the drop-down list. What I want to do is have a control in the parent browser window which can store the class_id and the...
2
23514
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent window to open a child window thru javascript window.open 2) I have some functionality in the child window that changes the data
1
11583
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
1
1961
by: Bill Borg | last post by:
Hello all, Simple chat app, where the site owner has a master window with all requests for chat, status of each room, etc., and child windows for each separate chat in which the owner is engaged. When the owner closes one of his child windows, I want to update the master window. I understand "reasonably" well how to go about this. The master window launches the children, and maintains an associative array to keep track of each one....
2
3068
by: Mindy | last post by:
Hey, I want to create links between my two tables. The primary keys of these two tables are character variables, with length =11. I followed exactly the instruction of Dummuy Book for ACCESS 2003. I click the primary key of table A , and hold and move the mouse to table B. But nothing happened. No line, no error reminders. Does anyone know what's happened? Thanks. Mindy
4
2095
by: Robert Bravery | last post by:
Hi all, I have now correctly set up my dataset and two grids, so that the parent navigates the child. THe thing is that the child table is actually a lookup type table. It lists billing types for the parent table, so that I just store a key in the parent table, and the show the billing type description from the child I need to set this up in one grid. I have played arround with the tables and columns collection in the ID, but cant seem to...
4
3985
by: Buddha | last post by:
Hello, I posted this on two forums, without too much help .. and I am kinda stuck in this. I need to refresh the parent page from the second child window which is opened by the first child and the first child window closes after opening the second child. This is the second time I am typing the post, I lost all content because the site complaine I was using the lesser than symbol.
9
4635
by: warrior2009 | last post by:
I have 2 lists (unlinked and unrelated), where one can be called the parent and the other the child with one to many relationship between parent-child. The child table is really big, over a million records. The link between the two, is a set of 3 fields that must be equal between the two. So when the two match, there can be a number of records in the child field, because it is related to the usage history of the parent record. So here is my...
0
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9953
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.