Problem: Altering cell content in a <TABLE> on demand

E

edwin Boyette

I would like to be able to set the content of a cell " <TD> <TD> " = to a
variable, most likely store the data or content in an array, and then write
the data in reponse to an action. Any thoughts on this I have been poking
around all over the place and couldn't find a solution.
 
M

Michael Wilcox

edwin Boyette said:
I would like to be able to set the content of a cell " <TD> <TD> " =
to a variable, most likely store the data or content in an array, and
then write the data in reponse to an action. Any thoughts on this I
have been poking around all over the place and couldn't find a
solution.

HTML isn't a programming language, so look into one instead (I highly
recomend PHP).
 
B

Bagbourne

Michael said:
Learn the bare basics at www.php.net or www.phpfreaks.com (which has much
more advanced articles as well) and one at
http://hotwired.lycos.com/webmonkey/01/48/index2a.html?tw=programming (which
I haven't tried).

edwin, they are all taking about server-side modification of the page. A
reload of the page. You can't have poked around much to miss Javascript!

You can use Javascript manipulation of the document to achieve the same
thing within the client browser without reloading the page - provided
that your user has a javascript enabled browser. It depends on the
environment that your users have.

Have a look at http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929
appendinx D, "ECMA Script Language Binding". (ECMA script being the
standardized version which most Javascript adheres to)

You can access all elements of the document.

<td id="mycell">
....
<script type="text/javascript">
var cell = document.getElementById("mycell");
.....
</script>

Remove all child nodes from the cell, and add the ones you want.

To create a text node to append to the cell, use
document.createTextNode("hello world");

For more help on this, take it to comp.lang.javascript.

Nige
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top