Click to See Complete Forum and Search --> : Limit number of characters in a table cell acording its size


abcde
01-27-2004, 12:57 PM
Its something i searched a lot but never found.. a javascript that dynamically reduces the number of chars in a table cell instead of placing them in a new line when the size of the table cell is changed.

I would apreciate it very much if theres a way.

Thanks!:D

mkoss
01-27-2004, 02:19 PM
Hmm, this is a tricky one. I have an idea, but I don't have the time at the moment to try to code it. But here's some pseudo-code of how I would try to tackle this:


<td nowrap="true">some very very very very long text</td>

<script>

var destinationWidth = 100;
while (td.style.width > destinationWidth)
{
td.innerText = //td.innerText - 1 character
}

</script>