"yukatan" <a@a.com> writes:
let's say this is a html table, how can i get the string value contained in
the X cell ?
Don't draw using a proportional font. There is little chance that the
receiver uses the same proportional font. If you draw using a fixed
width font, then at least all other fixed width fonts will give a
correct drawing. My newsreader uses a fixed with font, as does a lot
of others.
---------------------
| | | |
---------------------
| | | |
---------------------
| X | | |
---------------------
| | | |
---------------------
To get the cell, assuming that the id of the table is "tableId":
var table = document.getElementById("tableId");
var row = table.rows[2];
var cell = row.cells[0];
The hard part is getting the content of the cell. If it is plain,
unstyled text, then you can probably use:
var content = cell.firstChild.nodeValue;
Otherwise you must either use proprietary methods like cell.innerText
that doesn't work in all modern browsers, or you must gather the text
recursively. Since you just say "string value", I assume it is plain,
unstyled text.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'