mredkj.com logo

An update blog for mredkj.com

What's this blog about?

mredkj.com is an unfocused programmer resource from Matt, Eric, and Keith

This blog will keep you up to date with our latest site changes.

Tuesday, August 16, 2005

Table Basics - Add Rows / Delete Rows

tablebasics1.html

I think some people are arriving at the mredkj.com pages tableaddrow.html and tabledeleterow.html and finding more than they need, so I put together a simple tutorial.

I plan on creating another tablebasics page (I didn't name this one tablebasics1 for nothing), and restructuring the other more advanced examples in tableaddrow and tabledeleterow.

posted by Keith [8/16/2005 03:28:00 AM] - permalink - 8 comments

8 comment(s):

Anonymous Anonymous wrote:

how to delete row using radio button. pls help

Posted [10/18/2005 08:19:00 AM]  

Anonymous Anonymous wrote:

how to delete row using radio button. pls help

Posted [10/18/2005 08:19:00 AM]  

Blogger Keith wrote:

how to delete row using radio button

It would only require a couple changes, but it appears that Internet Explorer doesn't like dynamically added radio buttons.

When I tested it in IE 6, the new radio buttons couldn't be checked. It worked fine in Firefox and Opera though.

Therefore I offer the following code as suggestions for anyone else that wants to test it, but it is not a solution.

In my addRowToTable function change:

cbEl.setAttribute('type', 'checkbox');

to

cbEl.setAttribute('type', 'radio');
cbEl.setAttribute('name', 'testx');


In my function deleteChecked, change

if (tbl.rows[i].myRow && tbl.rows[i].myRow.three.getAttribute('type') == 'checkbox' && tbl.rows[i].myRow.three.checked) {

to

if (tbl.rows[i].myRow && tbl.rows[i].myRow.three.getAttribute('type') == 'radio' && tbl.rows[i].myRow.three.checked) {

Posted [10/18/2005 10:07:00 AM]  

Blogger Keith wrote:

By the way, my suggested code changes are to the example in tabledeleterow.html

Posted [10/18/2005 10:09:00 AM]  

Anonymous Anonymous wrote:

this is a great tutorial. Thank you very much. but there is one question, when I refresh the page, the inserted row is gone. i need that row to use the data inside a txt box. Would you help me? Thank you very much!

Posted [3/23/2006 07:41:00 PM]  

Blogger Keith wrote:

lei millman said...
there is one question, when I refresh the page, the inserted row is gone.

You would need to persist the data. One way is by using cookies, although that might become cumbersome. Another way would be server side using Ajax. At this time I don't have an exact solution for you, but it might be something I could work on in the future.

Posted [3/23/2006 10:15:00 PM]  

Anonymous Anonymous wrote:

cannot access the text form elements reliably as
document.forms[0].somename.value

when I am using numbers and summing , the numbers add up correctly, but calculations are always wrong. copied the algorithm from a spreadsheet that reconciles checkbooks. values in the table get assigned get assigned to other places outside. weird things happening in firefox 2.0. and I can only get this to work in firefox. can't access the form fields in IE6 - they don't exist. (I know everyone uses IE7 now, but win2k users are still on IE6). help.

Posted [11/29/2006 06:27:00 PM]  

Blogger Keith wrote:

Anonymous wrote...
"cannot access the text form elements reliably as document.forms[0].somename.value"

I'm not sure what your question is.

Posted [12/03/2006 05:56:00 PM]  

Post a Comment