wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes is it possible to count the number of lines in the div element? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "is it possible to count the number of lines in the div element?" Watch "is it possible to count the number of lines in the div element?" New topic
Author

is it possible to count the number of lines in the div element?

yuvaraj KumarAmudhan
Ranch Hand

Joined: Aug 22, 2009
Posts: 110
I have a div element and its innerHTML is some number of lines, loaded at runtime from the file.
i need to count the number of lines of that div element. i didn't get any idea about that!
idea please!

thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
It is not easy, since I doubt you are asking about counting breaks.

If the text is all the same size, you can probably look at line-height and text-size. With that you might be able to guess.

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

That's a really odd thing to do. Why do you need to do this?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
yuvaraj KumarAmudhan
Ranch Hand

Joined: Aug 22, 2009
Posts: 110
i have to modify the particular line dynamically. thats why i need to count the lines in a div element.

thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Perhaps if you supply a little more detail, we can help. Identifying a passage by "line" is really difficult and probably non-deterministic.

Perhaps the passage that needs to be modified can be identified as a <span> or other element that'll make this a whole lot easier and less error-prone.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is it possible to count the number of lines in the div element?