dynamic table row creation in html/Javascript
I have html table w开发者_如何学Goith 1 row to fill in job details for a position.Now If a user wants to fill in job details for another position,on clicking a link, a new row should be created dynamically each time the user clicks the link.Can any one please help me with the code in html
I'm using frontpage.
Thanks, Vix
I would suggest looking into jQuery, the most powerful javascript framework. It is popular and you can find lots of references, resources, plugins, code etc. to help you do lots of this stuff.
Here is a stackoverflow question covering adding a table row to a table using jQuery. Add table row in jQuery
in simple Dom-Javascript without any frameworks you could use something like this
var tr = document.createElement('tr');
var td1 = document.createElement('td');
var someDivToAppend = document.createElement('div');
someDivToAppend.innerHTML = "Some basic text content";
td1.appendChild(someDivToAppend);
tr.appendChild(td1);
...
But I guess that's probably too much handy work, a library like jQuery could help you there. You could look at: http://api.jquery.com/append/
Also look at the YUI Datatable. Very full featured, and well documented.
精彩评论