473,245 Members | 1,519 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,245 software developers and data experts.

Detecting Where Text Wraps

Hi,

If I have a DIV containing a single text node, is there a way to
detect where (or if) the text in that node wraps?

<div>
Some text that possibly wraps to a second line.
</div>

I'd very much appreciate if someone could point me in the right
direction, or even tell me that it's not likely to be easily
accomplished.

Thanks,
Jeff
Aug 23 '08 #1
1 1807
Jeff Bigham wrote:
If I have a DIV containing a single text node, is there a way to
detect where (or if) the text in that node wraps?

<div>
Some text that possibly wraps to a second line.
</div>
IE exposes a method getClientRects which you could call on the div
element object and check the length property of the collection returned.
If it is greater than one then there are at least two lines of text in
the div. Each item in the collection is a TextRectangle object with
properties that should allow you to find where the text wraps
See
http://msdn.microsoft.com/en-us/libr...35(VS.85).aspx
An example is here:
http://samples.msdn.microsoft.com/wo...s/rectdemo.htm

I think Firefox 3.0 implements that method too but I have so far not
used it with Firefox so I don't know how compatible the implementations are.
http://developer.mozilla.org/en/DOM/...getClientRects
--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 23 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Csaba2000 | last post by:
How do I detect when the font size has been changed (especially by user action: either Ctrl+Scroll wheel or View/Text Size)? This is just for use on IE 5.5+, but it would be great if there was a...
0
by: Ron H. | last post by:
I have a data access page that has several edit boxes that display data. How do I set the test wrap function on an edit box so the text wraps between data items??? ( like MS Word wraps whole words...
9
by: D. Shane Fowlkes | last post by:
I'm using SQL Server 2000 and on my page, I'm simply creating a SQLDataReader and filling in Labels with the retrieved (single) record. However, how can I prevent from getting errors when a field...
25
by: junky_fellow | last post by:
Is there any way by which the overflow during addition of two integers may be detected ? eg. suppose we have three unsigned integers, a ,b, c. we are doing a check like if ((a +b) > c) do...
1
by: mmurrell | last post by:
I am developing some dhtml code that displays a balloon style help when a user mouses over words. The balloon help is positioned correctly until the tag (in this case) word-wraps. Is there any...
6
by: Andre Majorel | last post by:
How do you compute an off_t with overflow detection ? Ideally, the target language is C89/C90 and the target platform is reasonably recent versions of the major Unixen. If there is no practical...
0
by: JosAH | last post by:
Greetings, the last two article parts described the design and implementation of the text Processor which spoonfeeds paragraphs of text to the LibraryBuilder. The latter object organizes, cleans...
25
by: LeWaltz | last post by:
hi everyone, i am a newbie here, and i have a problem in my programming code... i wanted to make sure that i can only detect positive numbers, and not letters... examles: "abc", "ab100", "-100",...
0
by: eBob.com | last post by:
I'm trying to develop a control similar to TextBox and RichTextBox - less functional actually but with a wrinkle which I need and which TextBox and RichTextBox do not have. I can use a statement...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.