473,395 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Deleting rows from a table with button

Hello Everybody,

I have a table that has a delete button at the end of each row. I want
the row to disappear/delete when the user clicks on the delete button
for the corresponding row. I tried using the command
mytable.deleteRow() for the button but no luck. Here is the url for the
page. http://24.84.131.118/modelviewer/index.html and the javascript
is in http://24.84.131.118/loader.js . This is my first attempt at
javascript so all help will be greatly appreciated
thanks

gary

Jul 23 '05 #1
1 1392
Gary Dickinson wrote:
Hello Everybody,

I have a table that has a delete button at the end of each row. I want
the row to disappear/delete when the user clicks on the delete button
for the corresponding row. I tried using the command
mytable.deleteRow() for the button but no luck. Here is the url for the
page. http://24.84.131.118/modelviewer/index.html and the javascript
is in http://24.84.131.118/loader.js . This is my first attempt at
It's actually at:

<URL:http://24.84.131.118/modelviewer/loader.js>
javascript so all help will be greatly appreciated


Your onclick is;

<td><input type='button' value='X' onclick='
mytable.deleteRow()
'>
</td>
To delete a row, the syntax is table.deleteRow( index ) where 'table'
is a reference to a table and 'index' is the index of one of the rows.

You don't define 'mytable' or provide an index for which row to delete.

Try something like:

<td><input type='button' value='X' onclick='
delRow(this);
'>
</td>

And define delRow in your loader.js as:

function delRow(x) {
while ('TR' != x.nodeName.toUpperCase() ) {
x = x.parentNode;
}
var i = x.rowIndex;
while ('TABLE' != x.nodeName.toUpperCase() ) {
x = x.parentNode;
}
x.deleteRow(i);
}

--
RobG
Jul 23 '05 #2

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

Similar topics

10
by: AdamG | last post by:
I am trying hard for days now to add and delete rows to a table. I could really use some help... Each row contains two buttons (images) - 'add row' and 'delete row'. When the user clicks add...
1
by: Junkguy | last post by:
I'm having difficulty deleting rows from a datagrid. I want to put a "delete" button on a form and achieve the same functionality as hitting the "delete" key on the keyboard for the selected row of...
5
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am...
5
by: JonH | last post by:
Ok, I have this dynamically created table in my one of my php forms that shows the names of the people the user has entered into a text field. When they hit add a row displays, showing the name...
2
by: Muzzy | last post by:
Hi, I've used information on these newsgroups to build many pages. So I thought that now that I have my script working (something that I've been working on for about a week), I should post it so...
17
by: cygsoft | last post by:
Hi I have created a dynamic row and inserted the values into the cells of those rows from textboxes. Now I have to edit those values stored in the rows. At the end of each row created dynamically...
4
by: MiziaQ | last post by:
Hey, I'm using the following code to write entries to a data file and then read them in an msflexgrid. I now would like to add code under a delete button to use the table(grid) to delete rows from...
5
flexsingh
by: flexsingh | last post by:
Hello there, I have been trying to delete a row in php for a long time now and its getting frustrating, can any see if they could possible help me please. My first page is <?php // this...
3
by: nigelesquire | last post by:
Please help! I'm trying to clone and delete multiple rows with JavaScript. I need two delete buttons that work...! I only have one for now, but it's not working properly, the output count is...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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
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
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...

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.