473,497 Members | 2,155 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with add row in a table.

dmjpro
2,476 Top Contributor
My code goes here ........

Expand|Select|Wrap|Line Numbers
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  4. <title>Sample Test</title>
  5. <script type="text/javascript">
  6. function add_row(){
  7.     var row = document.getElementById('__debasis__').cloneNode(true);
  8.     document.getElementById('original_row').parentNode.appendChild(row);
  9. }
  10.  
  11. function copy_row(){
  12.     var row = document.getElementById('original_row').cloneNode(true);
  13.     row.setAttribute("id","__debasis__");
  14.     document.getElementById('clone_row').parentNode.appendChild(row);
  15. }
  16. </script>
  17. </head>
  18.  
  19. <body onload="copy_row()">
  20. <table width="100%" border="0" cellspacing="1" cellpadding="1">
  21.   <tr id="original_row">
  22.     <td><input type="text"/></td>
  23.     <td><input type="text"/></td>
  24.     <td><input type="text"/></td>
  25.   </tr>
  26. </table>
  27. <table width="100%" border="0" cellspacing="1" cellpadding="1" style="display:none">
  28.   <tr id="clone_row">
  29.   </tr>
  30. </table>
  31. <input type="button" value="Add Row" onclick="add_row()"/>
  32. </body>
  33. </html>
  34.  
First time the row gets added fine. Next time if i add a row by giving some values of texts to last row it gets copied to the newly added row.
But i cloned the empty row at onload time, so what does it happen?
Aug 5 '08 #1
1 1020
dmjpro
2,476 Top Contributor
I found the error.
Actually what happened, the id gets duplicated.
After a change to ....

Expand|Select|Wrap|Line Numbers
  1. function add_row(){
  2.     var row = document.getElementById('__debasis__').cloneNode(t  rue);
  3.     row.setAttribute("id",unique_id);
  4.     document.getElementById('original_row').parentNode  .appendChild(row);
  5. }
  6.  
Aug 5 '08 #2

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

Similar topics

11
4394
by: Wayne Wengert | last post by:
I am using VS.NET 2003, VB.NET, ADO.NET and an Access 2000 database. I want to display a list of all tables in an Access database. I want to put that list of table names in a listbox so the user...
5
8317
by: javaguy | last post by:
I have a data entry web application that is formatted heavily with tables. Having learned a bit of CSS, I'm hoping to rewrite this using <div> tags. But I have run into a formatting problem that...
20
2647
by: Neil | last post by:
I have an Access 2000 MDB file with a SQL 7 back end. I have a main table with 50,000 records; and I have a selections table with 50,000 records for each machine that uses the database (about...
3
1372
by: news.microsoft.com | last post by:
I am using client script to handle some XML stuff with MS XMLDOM But I ran into a problem in selecting the elements using selectNodes method The XML looks like: <root> ...........................
2
1775
by: DataB | last post by:
Hi everyone! I have a forms problem. Bakground: I have created a number of tables. Of these, I have a main parent table (Personal Details) and a number of other child tables (Tax file No.,...
4
3557
by: Dave | last post by:
Hey guys, I have an ODBC problem that has me stumped. I wrote a VBA script to run in Microsoft Excel that pulls data out of an application using that application's ODBC driver and puts it into...
12
2272
by: Riley DeWiley | last post by:
I have a project that is using a Jet backend and having trouble with Jet's tendency to bloat it's MDB file. I can compact it but it is a hassle. I am considering switching to a Fox backend but have...
9
9664
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
9
2752
by: QCLee | last post by:
Sir can you help me to transfer my Access Query to MS excel? i have a command button on the form to export the parameter query named "HVACWindwardQuery" to excel spreadsheet and i got the codes...
10
4355
by: amitabh.mehra | last post by:
Hi I havent used MQT before. Read the online tips and tutorials but none seems to give any hint for my problem. I have a base table (base_table) as: st varchar(25) default...
0
6993
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...
0
7162
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7197
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...
0
7375
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...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4899
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4584
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3088
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...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.