0
See a text width (in pixel)
In JavaScript, If I wanted to know what does a certain text take width of the line, what to do? I searched on the web, I found that I can use .cleintWidth ( https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript?noredirect=1&lq=1 ) But seems it did not work for me If I writed: var t='I'; document.write(t.clientWidth); the output would be "undefined" What is the wrong? How to fix that? Or there is another method to get a text width value?
2 odpowiedzi
0
FF9900
Thanks.
I noticed that I should add "window.onload" to works.
why exactly?