473,700 Members | 2,866 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Remove row & change id's

2 New Member
I want to remove one row from table by clicking on remove link(one for each row) and change their id's correspondingly (like remove 2nd row and assign 3rd row id=2nd row id i.e.,shift row id's)
Oct 20 '08 #1
3 3365
RamananKalirajan
608 Contributor
Hello Sir,
U can delete the particular row with the row index which is autogenerated in the Table, why do u want to change the rowId. I dont get ur point.

[HTML]<html>
<head>
<script type="text/javascript">
function doThis()
{
var myTab = document.getEle mentById('myTab le');
var row=myTab.rows. length;
var y=myTab.insertR ow(row);

var a=y.insertCell( 0);
var xx= document.create Element('input' );
xx.type="text";
a.appendChild(x x);

var b=y.insertCell( 1);
var xx= document.create Element('input' );
xx.type="text";
b.appendChild(x x);

var c=y.insertCell( 2);
var xx= document.create Element('input' );
xx.type="button ";
xx.value="Remov e"
xx.onclick="rem oveThis(this)"
c.appendChild(x x);
c.innerHTML = c.innerHTML;
}

function removeThis(ths)
{
var rIndex = ths.parentNode. parentNode.rowI ndex;
alert("rIndex = "+rIndex);
document.getEle mentById('myTab le').deleteRow( rIndex);

}
</script>

</head>
<body>
<br/>
<input type="button" value="Add" onclick="doThis ()">
<br/>
<table id="myTable" border="1" cellspacing="5" cellpadding="5" >
<tr>
<th>Name</th>
<th>Wage</th>
<th></th>
</tr>
</table>
</body>
</html>[/HTML]

Regards
Ramanan Kalirajan
Oct 20 '08 #2
winterwind
2 New Member
Thanks for kind reply.

Actually in my code i have Browse....Butto n(i.e. <input type='file'>) and remove(<a href=''>). By clicking on remove link it has to remove current row and like that it has to proceed. I want to check whether every row(every type='file' value) is null('') or some file is selected to upload a file. For that reason it has to remove current selected row and here with row id's problem comes in checking. Plz if u have any idea or code plz forward me..

Thanks again for ur kind reply




Hello Sir,
U can delete the particular row with the row index which is autogenerated in the Table, why do u want to change the rowId. I dont get ur point.

[HTML]<html>
<head>
<script type="text/javascript">
function doThis()
{
var myTab = document.getEle mentById('myTab le');
var row=myTab.rows. length;
var y=myTab.insertR ow(row);

var a=y.insertCell( 0);
var xx= document.create Element('input' );
xx.type="text";
a.appendChild(x x);

var b=y.insertCell( 1);
var xx= document.create Element('input' );
xx.type="text";
b.appendChild(x x);

var c=y.insertCell( 2);
var xx= document.create Element('input' );
xx.type="button ";
xx.value="Remov e"
xx.onclick="rem oveThis(this)"
c.appendChild(x x);
c.innerHTML = c.innerHTML;
}

function removeThis(ths)
{
var rIndex = ths.parentNode. parentNode.rowI ndex;
alert("rIndex = "+rIndex);
document.getEle mentById('myTab le').deleteRow( rIndex);

}
</script>

</head>
<body>
<br/>
<input type="button" value="Add" onclick="doThis ()">
<br/>
<table id="myTable" border="1" cellspacing="5" cellpadding="5" >
<tr>
<th>Name</th>
<th>Wage</th>
<th></th>
</tr>
</table>
</body>
</html>[/HTML]

Regards
Ramanan Kalirajan
Oct 20 '08 #3
RamananKalirajan
608 Contributor
Thanks for kind reply.

Actually in my code i have Browse....Butto n(i.e. <input type='file'>) and remove(<a href=''>). By clicking on remove link it has to remove current row and like that it has to proceed. I want to check whether every row(every type='file' value) is null('') or some file is selected to upload a file. For that reason it has to remove current selected row and here with row id's problem comes in checking. Plz if u have any idea or code plz forward me..

Thanks again for ur kind reply

This could help u out, but i dont know wether its ur requirement. Its just a small idea

[HTML]<html>
<head>
<script type="text/javascript">
function doThis()
{
var myTab = document.getEle mentById('myTab le');
var xx= document.create Element('input' );
xx.type="file";

var row=myTab.rows. length;
var y=myTab.insertR ow(row) ;
var b=y.insertCell( 0);
b.appendChild(x x);
b.innerHTML = b.innerHTML;

var xy=document.cre ateElement('inp ut');
xy.type="button ";
xy.value="Remov e";
xy.onclick="rem oveThis(this)";
var c=y.insertCell( 1);
c.appendChild(x y);
c.innerHTML=c.i nnerHTML;
}
function removeThis(ths)
{
var rowIndex = ths.parentNode. parentNode.rowI ndex;
document.getEle mentById('myTab le').deleteRow( rowIndex);
}
</script>
</head>
<body>
<input type="button" value="Attachme nt" onclick="doThis ()">
<br/>
<table id="myTable" border="1" cellspacing="5" cellpadding="5" >
</table>
</body>
</html>[/HTML]

Regards
Ramanan Kalirajan
Oct 21 '08 #4

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

Similar topics

9
2672
by: middletree | last post by:
I have a page which takes data in an HTML table, and exports it to an Excel file. It works fine, but I want several things about the spreadsheet to look different from the HTML version. Things like fonts and colors. I think I can use a style sheet for the latter, but I haven't figured out how to remove hyperlinks from some of the items. On the HTML page, the hyperlinks are useful, but I don't want the spreadsheet to have them. So on my...
1
3793
by: Zaidan | last post by:
I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA code (I will consider using javascript if I have to) that does the following, at the user command: 1- Start MS Explorer and go to my website. Login (enter ID and Password) 2- It will go and update some prices of some products that I sell 3- It will add new products or cancel some product I already have someone who wrote me in JavaScript a web form (no documentation...
12
6319
by: ~~~ .NET Ed ~~~ | last post by:
Hi, I have a standalone XML file (with the appropriate xml document header) that works fine when I load it using XmlDocument. I can have child elements like this without problems: <SomeChildElement type="c" href="There.aspx?id=5" /> But as soon as I change it to something like this: <SomeChildElement type="c" href="There.aspx?id=5&amp;t=m" />
2
11829
by: Joe Bloggs | last post by:
Hi, I am trying to remove the namespace in the root node in the following XML, <ordersHistory xmlns="http://tempuri.org/Orders.xsd"> <order number="PO-1" added="12/12/2002"> <client name="Microsoft"> <address country="USA" city="Washington" /> <notes> Produces a great framework for developing applications.
1
1972
by: JeffP | last post by:
Currently I have a user control which contain a <a href> link tag. I have a requirement to change the name property of the anchor tag to something like this: <a href="somepage.aspx" id"thislink" name="&lid=somename">Link</a> The problem is that when the aspx page renders this user control, the & character is converted to <literal>&amp;</literal>. So what I end with is: <a href="somepage.aspx" id"thislink"
0
1682
by: Mudiya Dissa | last post by:
Hi, I have some code on my application like the following <% redirectUrl = "mypage.asp?type=100&id=something&view=10 'some more asp code
14
5187
RMWChaos
by: RMWChaos | last post by:
Firebug is reporting "too much recursion" when I attempt to create a child element in a parent that doesn't exist yet. The script should automatically create the missing parent before going on to create the child element. At the point where the script is supposed to call itself with the new properties to create the parent, it gives me the error and looks like it's looping the function continuously. It seems that "id : attrib" (line 192) is...
0
5475
by: dolittle | last post by:
Hi, I'm embedding a last.fm flash widget. I want to be able to remove it from the page using javascript. I've tried to delete the html element that contains the code but it keeps playing in IE. In FF it stops playing but I can't tell if it is removed or not. Can I do it in javascript or maybe I need a FLASH script to do it?
0
8721
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
8642
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
9209
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8964
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8918
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...
1
6558
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4400
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...
1
3085
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
3
2024
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.