1.js方法 function cutString(str, len) { //length属性读出来的汉字长度为1 if (str.length * 2 <= len) { return str; } var strlen = 0; var s = ""; for (var i = 0; i < str.length; i++) { s = s + str.charAt(i); if (str.charCodeAt(i) > 128) { strlen = strl…
//多余显示省略号 function wordlimit(cname, wordlength) { var cname = document.getElementsByClassName(cname); for (var i = 0; i < cname.length; i++) { var nowLength = cname[i].innerHTML.length; if (nowLength > wordlength) { cname[i].innerHTML = cname[i].inn…