JavaScript method deleteRow()

This section illustrates you the use of JavaScript method deleteRow(). The deleteRow() method removes the row at the specified position from a table.

JavaScript method deleteRow()

     

This section illustrates you the use of  JavaScript method deleteRow(). The deleteRow() method removes the row at the specified position from a table.

Its syntax is:

table_object.deleteRow(index)

This index starts from 0 and is relative to the logical order of all the rows contained inside the table. If the index is -1 the last row of the table is deleted.

 

Here is the code:

<html>
<script>
function deleteRow()
{
document.getElementById('table').deleteRow(1);
}
</script>
<body>
<h3>Employee Information</h3>
<table id="table" border="1">
<tr>
<th>Name</b></th>
<th><b>Address</b></th>
<th><b>ContactNo</b></th>
</tr>
<tr>
<td>Angelina</td>
<td>New Delhi</td>
<td>1111111111</td>
</tr>
<tr>
<td>Martina</td>
<td>Mumbai</td>
<td>2222222222</td>
</tr>
</table>
<br />
<input type="button" onclick="deleteRow()" value="Delete Row">
</body>
</html>

Output will be displayed as:

On clicking the button, the row at the index 1 will be deleted.

Now if you click the button again, the row comes at the index 1 will be deleted.

Download Source Code:

 

     

Advertisements

Ads
Share on Google+Share on Google+

JavaScript method deleteRow()

Posted on: September 22, 2006 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: JavaScript method deleteRow()  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:1
Rohit
October 3, 2011
MS Access connectivity with javascript.

I want to connect MS ACCESS to a website by using javascript in HTML. Can you please help me with the code for connectivity.

Ads

 

Ads