The latest diary and the latest comment in the YLOG.NET homepage, the contents of the diary and the contents of the journal are often overspeed, and they can only describe the two words, which makes me headache ... first I think that I intercept one So this function is written in this operational JS, and the client can alleviate the server burden, and the JS has speed advantage when the string is operated.
Catstring (str, len)
{
IF (str.length> len)
Str = Str.Substring (0, LEN-3, STR) "...";
Document.write (STR)
}
script>
As a result, it can be understood that because the print length of English and Chinese is different, the result is uneven, it is obviously not the effect I want. Since the width of the Chinese is about twice aspect, then the Chinese is two English characters. Then, then cut out, restore # @ @ @% $ #! $ # Code I will not post, n long and complicated, the most important thing is that the width of the English characters in the ordinary font is not all like M and f will be much depressed and depressed for a long time, look at the layout part of the CSS2.0 manual, found that there is a property called overflow, the original text is as follows
Overflow: Visible | Auto | Hidden | Scroll
parameter:
Visible: Do not add a scroll bar without cutting. If this default is explicitly declared, the object will be cut into the size of the Window or Frame containing the object. And the CLIP property setting will be invalid
Auto: This is the default value of the body object and TextArea. Cut the content while needing and add a scroll bar
Hidden: Does not show content of the object size
Scroll: Always display scroll bar
Description:
Search or set how to manage content when the content of the object exceeds its specified height and width.
Setting the TextArea object to hide its scroll bar for the hidden value.
For Table, if the table-layout property is set to fixed, the TD object supports overflow properties with the default value Hidden. If set to Hidden, Scroll, or Auto, the content that exceeds the TD size will be cut. If set to Visible, an additional text overflows to the lower or left (depending on the Direction property setting) unit.
Since IE5, this property is available on the Mac platform.
The corresponding script feature is Overflow. Please refer to other books I have written.
There is also an attribute that the text-overflow this property is set to Ellipsis, but only IE6 support seems to be solved, according to the above properties, you can write the code .... You can copy The Notepad is kept in an HTM file test ....
转载请注明原文地址:https://www.9cbs.com/read-11010.html