[web] Dynamic Html Tables
I am trying to create a table that can be changed with javascript. Similar to how you can change a text box. Help would be greatly appreciated.
God Bless
Show some source from your own attempt and people will help you figure out what needs fixing, otherwise you're basically asking people to do it for you - and noone want's to do that. Also, clarify what exactly you want to change? Simply the data within the table, or the actual table itself (number of cells, layout, etc)?
Hints:
-You'll need to assign IDs where appropriate to refer to what you're changing.
-DIV (and to only a slightly lesser extent SPAN) are very useful.
__________________________
Google is your friend.
Hints:
-You'll need to assign IDs where appropriate to refer to what you're changing.
-DIV (and to only a slightly lesser extent SPAN) are very useful.
__________________________
Google is your friend.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>how to fill in a table...</title><meta http-equiv=content-type content='text/html; charset=UTF-8'></head><body onload="fillInTable();"><script type="text/javascript">var table = { foo: [2, 3, 4], blah: ['cheese', 'grapes', 'wine'], baz: ['insert', 'stuff', 'here'] };function fillInTable() { var html = '<table>'; for(name in table) { html += '<tr><th>' + name + '<\/th>'; for(index in table[name]) html += '<td>' + table[name][index] + '<\/td>'; html += '<\/tr>'; } document.getElementById('foobar').innerHTML = html + '<\/table>'; }</script><div id="foobar">To be filled in by script.</div></body>
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement