Text is hidden after a limited number of words

Source: Internet
Author: User

<!DOCTYPE HTML><HTML><HeadLang= "en">    <MetaCharSet= "UTF-8">    <title>Text is hidden after a limited number of words</title>    <style>. Text{width:800px;Height:48px;Line-height:24px;Color:#333;background:#ccc;Border:#eaeaea 1px solid;margin:40px Auto;        }. Text1{width:500px;Height:72px;        }    </style></Head><Body><Divclass= "text">Before the Academy Awards, DiCaprio won the Best Actor award at the British Academy of Film and Television Arts (BAFTA) this year. The award is considered a prelude to the Academy Awards. Although he has been nominated for three times, fans have been grievances for him, but DiCaprio has not won an Oscar yet.</Div><Divclass= "Text Text1">Before the Academy Awards, DiCaprio won the Best Actor award at the British Academy of Film and Television Arts (BAFTA) this year. The award is considered a prelude to the Academy Awards. Although he has been nominated for three times, fans have been grievances for him, but DiCaprio has not won an Oscar yet. But DiCaprio has not won an Academy Award yet. But DiCaprio has not won an Academy Award yet.</Div><Script>    //gets the element according to the class name, in this case the reason is to get the element name with class, in order to control the string degree of multiple elements (TEXT,TEXT1).    functionGetbyclass (oparent, sclass) {if(oparent.getelementsbyclassname) {returnOparent.getelementsbyclassname (Sclass); } Else {  //IE 8 7 6            vararr= []; varReg= NewRegExp ('\\b' +Sclass+ '\\b'); varAele=Oparent.getelementsbytagname ('*');  for (varI= 0; I<aele.length; I++) {                if(Reg.test (aele[i].classname)) {Arr.push (aele[i]); }            }            returnarr; }    }    functionTestauto () {varTextname=Getbyclass (document,'text');  for (varI= 0; I<textname.length; I++) {            varNowleng=textname[i].innerhtml.length; if(Nowleng>  - ) {                varNowword=Textname[i].innerhtml.substr (0,  -) + '······'; Textname[i].innerhtml=Nowword; }}} Testauto ();</Script></Body></HTML>

Text is hidden after a limited number of words

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.