Question : Truncate text to n character of a string

Hello,
I want to truncate the body field of a Announcement list to n character.  I had read a great article on doing this by using jquery (http://www.moss2007.be/blogs/vandest/default.aspx).  The problem is that I do not how to integrate it to charepoint.  I had tried to use content editor web part and have download jquery.js but have not been able to have it work.  Any idea?  Thanks in advance.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
  
      
      

 
 
     <span style="display:none;" id="el_ 
      
     _ 
      
     "> 
      
     </span> 
      
     <script type="text/javascript"> 
     $(function() 
     { var mySpan = $('#el_ 
      
     _ 
      
     '); 
       var myShortText = $(mySpan).text().substring(0, 20);  
       if ($(mySpan).text().length > 20) 
         myShortText += '...'; 
 
       $(mySpan).show().html(myShortText); }); 
     </script> 

Answer : Truncate text to n character of a string

For someone else further reference:  After a lot of headaches
I was able to limit the character of the body field on an announcemnet field in the Schema.xml file by entering the following code in the ViewBody tag:
<ViewBody>

      <HTML><![CDATA[<TR class="]]></HTML>
      <GetVar Name="AlternateStyle" />
      <HTML><![CDATA[" id="borderComponent">]]></HTML>
      <IfEqual>
            <Expr1>
                  <GetVar Name="AlternateStyle" />
            </Expr1>
            <Expr2>ms-alternating</Expr2>
            <Then>
                  <SetVar Scope="Request" Name="AlternateStyle" />
            </Then>
            <Else>
                  <SetVar Scope="Request" Name="AlternateStyle">ms-alternating</SetVar>
            </Else>
      </IfEqual>

      <!-- Title field-->
      <HTML>
            <![CDATA[                        
                                          <TD width=20% class="ms-vb" style="padding-bottom: 3px"><span class="ms-announcementtitle">
                    ]]>
      </HTML>
      <Field Name="LinkTitleNoMenu" />
      <HTML><![CDATA[</span></TD> <TD width=50% style="padding-left: 2px, padding-right:2px>]]></HTML>

      <!-- Body field that limits the amount of characters displayed-->
      <Limit Len="125" IgnoreTags="TRUE" MoreText="...">
            <Field Name="Body" />
      </Limit>

      <!-- Created On field-->
      <HTML><![CDATA[</TD><TD width=10%> ]]></HTML>
      <Field Name="Created_x0020_On" />
      <HTML><![CDATA[</TD><TD width=20%> ]]></HTML>

      <!-- Author field-->
      <Field Name="Author" />
      <HTML><![CDATA[</TD> ]]></HTML>
      <HTML><![CDATA[</TR>]]></HTML>
</ViewBody>

Random Solutions  
 
programming4us programming4us