473,473 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

deleteRow leaves empty <TR></TR> pairs

In both IE6 and Netscape 7:

insertRow method of tbody is behaving as expected:
- inserts a new row
- increases tbody.rows.length

BUT deleteRow is not doing the opposite.

It DOES delete the row, but it adds a <TR></TR> pair just before the
</TBODY> and that leaves the tbody.rows.length count unchanged.

Demo page at http://www.btinternet.com/~geddes.winster/drtable.htm

What am I doing wrong?

John Geddes
Jul 20 '05 #1
2 3647
"John Geddes" <jo**@starmarkassociates.co.uk> wrote in message
news:70**************************@posting.google.c om...
In both IE6 and Netscape 7:

insertRow method of tbody is behaving as expected:
- inserts a new row
- increases tbody.rows.length

BUT deleteRow is not doing the opposite.

It DOES delete the row, but it adds a <TR></TR> pair just before the
</TBODY> and that leaves the tbody.rows.length count unchanged.

Demo page at http://www.btinternet.com/~geddes.winster/drtable.htm


Snippet of your code:
function delRow(tabName){
var thisBody=document.getElementById(tabName);
var origLength=thisBody.rows.length;
var tr= thisBody.insertRow(thisBody.rows.length); //Why this?
var rowNo=document.aForm.t1.value;
if (thisBody.rows[rowNo]){
thisBody.deleteRow(rowNo);
var tb2=document.getElementById(tabName);
alert("attempted to delete row index="+ rowNo+ " from
"+tabName+String.fromCharCode(10)+"rowCount changed from "+origLength+" to
"+thisBody.rows.length+String.fromCharCode(10)+"CH ECK length with redefined
tbody: "+tb2.rows.length);
} else {
alert("no row in "+tabName+"with index "+rowNo);
}
}
Try get rid of statement:

var tr= thisBody.insertRow(thisBody.rows.length);

Jul 20 '05 #2
Looks like I copied the addRow script and forgot to kill that line.

Must be spending too long staring at the screen.

Thanks so much.

John Geddes

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: F. Da Costa | last post by:
Hi, I' looking to retrieve ProdName1 form the <tr> below. <tr id="1-1-1" class="even"> <td> <div class="tier4"> <a href="#" class="leaf"></a> ProdName1 </div>
4
by: El Diablo | last post by:
Hi there, I'm trying dynamically generate extra rows in a table. So far this achieves this task within the tHead segment: theTable.tHead.appendChild(document.createElement('TR')) ....but...
4
by: Dominic | last post by:
I'm looking for a HTML editor that can match the opening and closing HTML tags such as <TR> </TR>, <TD> </TD> I think Dreamweaver does that, right? Even if it does, it may be too expensive for...
1
by: prefersgolfing | last post by:
I'm not using Master Pages, yet I'd like to display the contents of an HTML page within a <table><tr><td> on a .aspx. I have a lengthy guide already paginated in html. I'd like to embed the...
2
by: petereffect | last post by:
i have foll. code <tr> <a href="a1.shtml"> <td width='100%'> &nbsp;"+Testing+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td> </a>
5
by: mahesr | last post by:
I want to match some particular text between <tr>and </tr> or <td>and </td>.... in PHP. like below............ <table><tr> CATEGORY: <td><font face="Verdana" size="1" color="#A000A0"> Wedding...
3
by: jack | last post by:
Hi all im Creating a report in HTML with the help of dotnet.. im creating a which shows a data of 12 months .. the forst row of the column contains month names.. and the following data.. The...
7
by: Xiaoyan | last post by:
Hi,everyone: I have a problem now. I can't get the information between the <tr><td> and </td></tr>. for example: I use this regular expression can't get it, I don't know why....
7
by: cmrhema | last post by:
Hi, I have two questions. 1. I have heard that replacing a <tr> <td> with <div> tags increases the rendering speed. Is it so, and if yes which speed does it increase, rendering speed or loading...
0
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
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.