473,326 Members | 2,438 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,326 software developers and data experts.

Detect table cell overflow

2
I'm using a fixed width <DIV> with the following CSS style assigned:

text-overflow:ellipsis;
overflow:hidden;

Does anyone know how, using Javascript, to detect whether the <DIV> has overflowed i.e. its contents have grown too big?
Aug 8 '06 #1
4 7266
iam_clint
1,208 Expert 1GB
maybe? get the element by name or id and its innerhtml and check its length and figure out how many characters is too long.
Aug 8 '06 #2
mhart
2
maybe? get the element by name or id and its innerhtml and check its length and figure out how many characters is too long.
Thanks for the suggestion, but doesn't the length depend on the size of the text within the container i.e. CSS style, browser text size etc.? I don't think counting the characters will help.
Aug 10 '06 #3
iam_clint
1,208 Expert 1GB
Thats a hard question, i can't give you a clean answer because that would be a super complex code i would think to make sure the clients resoultion is the same the clients font size is the same all kinds of stuff go into something like that, and its not very practical what is it exactly your wanting todo i might help you find an alternative way todo it.
Aug 11 '06 #4
cohana
1
Hello,
I hope it's not to late to answer. I just had the same issue and did some work around. Works with IE6 so far. The idea is to not set the overflow in CSS but have the javaScript take care of it. See script below. I hope this helps.

function isOverflown( o )
{
b4 = o.offsetHeight;
mn.style.overflow = "auto";
af = mn.offsetHeight;
return ( b4 != af );
}
Nov 27 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Paul E Collins | last post by:
I need to 'clip' text in a table cell instead of wrapping it, such that (i) the cell keeps its specified fixed width and (ii) any text that overflows the cell should be 'clipped' (hidden or...
2
by: Big Slim | last post by:
I'm trying to use the OVERFLOW property to make only part of a table scrollable, but to no avail. You can split a table into two tables, with your column headers in the top table and your data...
3
by: N. Demos | last post by:
I have a single row table with fixed dimensioned cells nested inside a fixed dimensioned div, which has overflow: hidden. The div's dimensions are such that It should only display the first two...
5
by: cool2005 | last post by:
I have a table contains 4 cells (2 x 2) like this http://www.coolshare.com/planttrade/temp/gap.jpg each cell contains a div and the div contains a table. As you can see from the image above,...
3
by: john | last post by:
I want to set the cell width and height such that the cell doesn't get bigger. If the text is too long for the cell, it should be clipped. It only has to work for IE. I have tried setting the...
5
by: Jean Pion | last post by:
Dear readers, Can anyone explain how to set column width of a table in ccs. I use the following style in an external stylesheet: table.tbl { table-layout:fixed; border-top: 5px solid #333;...
2
by: Jason Chu | last post by:
Simple compatibility question, I have this: <table height="100%" width="50%" border="1"> <tr height="50%"> <td> <asp:Panel id="Panel1" runat="server" Height="100%" Width="100%"...
18
by: chimalus | last post by:
I am using a table with no column widths specified, letting the table layout manager do its thing for figuring out the column widths, and this works just fine. Now I want to make the table...
1
by: meworkingman | last post by:
I'm a relative CSS newbie and I'm trying to do the following: I have a table that holds text that might span multiple cells. I want it to look something like this: ...
3
by: chris f | last post by:
In my table (ASP.NET 2) that is dynamically generated I have a cell that initially will only display N rows of text and hide the rest. (This is so that the rows have a small height and I can...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.