Click to See Complete Forum and Search --> : width of innerHTML element
how to get the 'test test test' width?
<span style="font-family: verdana;font-size:20px;font-weight:bold">test test test</span>
thanxx :)
karayan
07-23-2003, 11:25 AM
Name the span, get its innerHTML, put it into a String object and then read the value of the string's .length property.
AdamBrill
07-23-2003, 11:29 AM
If you meant actual pixel width, I don't think that is possible. At least if it is, I don't know how. ;)
karayan
07-23-2003, 11:29 AM
Oh, now I get it. You want the geometric width of the actual span.
Here is an idea: Is it possible to place the span in an invisible table (noborder , etc.), and then read off the table's width? If that is possible, based on some constants, you should be able to translate that into span width. Just an idea.