bauhsoj
07-27-2006, 05:50 PM
How could I determine the width of text so that the DIV I wrap it in can be resized to exactly that width?
|
||||
Determining text widthbauhsoj 07-27-2006, 05:50 PM How could I determine the width of text so that the DIV I wrap it in can be resized to exactly that width? vwphillips 07-27-2006, 06:53 PM <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <script language="JavaScript" type="text/javascript"> <!-- function CkWidth(obj){ obj.style.width=(200)+'px'; while (obj.offsetHeight<obj.scrollHeight){ obj.style.width=(parseInt(obj.style.width)+2)+'px'; } } //--> </script></head> <body> <div style="position:relative;overflow:hidden;width:200px;height:20px;" onclick="CkWidth(this);" > 1234 1234 1234 1234 1234 1234 </div> </body> </html> |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum