[web] Dynamic Html Tables

Started by
1 comment, last by smart_idiot 19 years, 7 months ago
I am trying to create a table that can be changed with &#106avascript. Similar to how you can change a text box. Help would be greatly appreciated. God Bless
Advertisement
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.

- Jason Astle-Adams

<!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>
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.

This topic is closed to new replies.

Advertisement