Hi all,
I am very new to this but have look some of the examples of deleting tables and or rows with Java. The only problem is that all examples I have seen talke about one table and one or more buttons. What I needs to do is have 4 single row / dual columns tables each having a button of their own for deleting this table.
Here is what I got but it just doesnt work for me as each table has a seperate Table ID.

<script language=javascript>
function removeRow(src)
   {
       var oRow = src.parentElement.parentElement;	
       document.all("tblGrid").deleteRow(oRow.rowIndex);
   }
</script>
<table id="tblGrid" style="table-layout:fixed" border="1" bgcolor="#CCCC99" width="259" height="10">
<tr>
<td width="67">
<p align="center"><input type="button" value="Delete" onclick="removeRow(this);" /></td>
<td>
<span lang="en-gb"><b><font face="Arial" size="4" color="#336699">Authentication</font></b></span></td>
</tr>
</table>
			
&nbsp;<BLOCKQUOTE>
<p><font color="#FF0000">Freeform text entry</font></p>
<p/>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
		
<table id="tblGrid1" style="table-layout:fixed" border="1" bgcolor="#CCCC99" width="259" height="10">
<tr>
<td width="67">
<p align="center"><input type="button" value="Delete" onclick="removeRow(this);" /></td>
<td>
<span lang="en-gb"><b><font face="Arial" size="4" color="#336699">Authentication</font></b></span></td>
</tr>
</table>

Thanks for any help,
Mike

I could not get question exactly.
But i think want to remove the table on click to delete button. If this the case then following solution will work.

<script language="javascript">
function removeRow(src)
{
	document.getElementById(src).style.display = "none";
}

This will hide the table from user.

<table id="tblGrid" style="table-layout:fixed" border="1" bgcolor="#CCCC99" width="259" height="10">
<tr>
<td width="67">
<p align="center"><input type="button" value="Delete" onclick="removeRow('tblGrid');" /></td>
<td>
<span lang="en-gb"><b><font face="Arial" size="4" color="#336699">Authentication</font></b></span></td>
</tr>
</table>
&nbsp;<BLOCKQUOTE>
<p><font color="#FF0000">Freeform text entry</font></p>
<p/>
<p>&nbsp;</p>
<p/>
<table id="tblGrid1" style="table-layout:fixed" border="1" bgcolor="#CCCC99" width="259" height="10">
<tr>
<td width="67">
<p align="center"><input type="button" value="Delete" onclick="removeRow('tblGrid1');" /></td>
<td>
<span lang="en-gb"><b><font face="Arial" size="4" color="#336699">Authentication</font></b></span></td>
</tr>
</table>
&nbsp;<BLOCKQUOTE>
<p><font color="#FF0000">Freeform text entry</font></p>
<p/>
<p>&nbsp;</p>

Here look carefully i m not passing the 'this' to the function instead just pass the table name.

I could not get question exactly.
But i think want to remove the table on click to delete button. If this the case then following solution will work.

<script language="javascript">
function removeRow(src)
{
	document.getElementById(src).style.display = "none";
}

This will hide the table from user.

<table id="tblGrid" style="table-layout:fixed" border="1" bgcolor="#CCCC99" width="259" height="10">
<tr>
<td width="67">
<p align="center"><input type="button" value="Delete" onclick="removeRow('tblGrid');" /></td>
<td>
<span lang="en-gb"><b><font face="Arial" size="4" color="#336699">Authentication</font></b></span></td>
</tr>
</table>
&nbsp;<BLOCKQUOTE>
<p><font color="#FF0000">Freeform text entry</font></p>
<p/>
<p>&nbsp;</p>
<p/>
<table id="tblGrid1" style="table-layout:fixed" border="1" bgcolor="#CCCC99" width="259" height="10">
<tr>
<td width="67">
<p align="center"><input type="button" value="Delete" onclick="removeRow('tblGrid1');" /></td>
<td>
<span lang="en-gb"><b><font face="Arial" size="4" color="#336699">Authentication</font></b></span></td>
</tr>
</table>
&nbsp;<BLOCKQUOTE>
<p><font color="#FF0000">Freeform text entry</font></p>
<p/>
<p>&nbsp;</p>

Here look carefully i m not passing the 'this' to the function instead just pass the table name.

Thanks for the fast reply. You got the question right. Your solution might work but is there any way to just delete the table instead of hiding it?

Java != JavaScript

Next time, please find a JavaScript forum.

Thanks. Sorry for the wrong forum.

Please mark the thread as solved if you get the answer.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.