View Single Post
  #1 (permalink)  
Old September 6th, 2003, 10:58 AM
jerimorris jerimorris is offline
Registered User
Join Date: Jun 2003
Location: na, na, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Finding width of text


I'm using JavaScript and DOM to position DIVs and SPANs on a page. It would be a lot easier if I could figure out the width of text within a DIV or SPAN without having to explicitly set it.

For example, if I have a SPAN with the text "abcde," and I haven't explicitly set the width of the SPAN, is there a way I can determine the width in pixels of either the SPAN element or the text within it? (I'm not using a fixed-width font, so I can't calculate the width based on the number of characters.)

Thank you in advance for your help!

jerimorris2000 @ yahoo . com