The JavaScript string handler function, which intercepts the string according to the length of the definition, cuts out the append ... many times the content displayed on the page needs to be indented "..." This method is used to process the string display fixed length, the extra-long part with "..." instead of:
/** Parameter Description: * Based on length interception first use string, Extra long part append ... * str object string * len target byte length * return value: Process result string*/functioncutstring (str, len) {//the Length property reads 1 Chinese characters . if(Str.length*2 <=Len) { returnstr; } varstrlen = 0; vars = ""; for(vari = 0;i < str.length; i++) {s= S +Str.charat (i); if(Str.charcodeat (i) > 128) {strlen= strlen + 2; if(Strlen >=Len) { returnS.substring (0,s.length-1) + "..."; } } Else{strlen= strlen + 1; if(Strlen >=Len) { returnS.substring (0,s.length-2) + "..."; } } } returns;}
JS automatically intercept string length, add ellipsis "..."