...

View Full Version : Append a new row to a table / datagrid



pbeechey
01-20-2005, 01:20 PM
Hi All,
Appologies if this was answered recently but I cannot see it anywhere,

Basically I have a large HTML pages generated from a datagrid.

A user needs to be able to create a row that will be appended to the bottom of the table such that it can be processed the next time the page is posted to the server.

Could someone please provide an example of how I can accomplish this using Javascript?

Any help would be really appreciated.

Cheers,
Paul.

don
01-20-2005, 08:45 PM
I don't know if it will work with a datagrid, but this is how you can add a row to a table and add class/style stuff:

function addRow(tbl) {
var t=document.getElementById(tbl)
var tr=t.insertRow(1)
tr.style.height="20"
tr.className = "sampleRow"
var td=tr.insertCell(0)
td.innerHTML="<a class='sampleCell' href='http://foo.com'>Bar</a>"
}

For more information, see http://www.mozilla.org/docs/dom/domref/dom_html_ref31.html



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum