记录unterminated string literal报错解决

//截取字符串 str字符串 len截取的长度
function cut_str(id, len){
    var str=$("#"+id+" a:eq(0)").attr("title");
    var char_length = 0;
    if(str.length<=len)
     return str;
    for (var i = 0; i < str.length; i++){
        var son_str = str.charAt(i);
        encodeURI(son_str).length > 2 ? char_length += 1 : char_length += 0.5;
        if (char_length >= len){
            var sub_len = char_length == len ? i+1 : i;
            return str.substr(0, sub_len);
        }
    }
    return str;
}


function cut_str2(str, len){
    var char_length = 0;
    if(str.length<=len)
     return str;
    for (var i = 0; i < str.length; i++){
        var son_str = str.charAt(i);
        encodeURI(son_str).length > 2 ? char_length += 1 : char_length += 0.5;
        if (char_length >= len){
            var sub_len = char_length == len ? i+1 : i;
            return str.substr(0, sub_len);
        }
    }
    return str;
}


<#list listme as jsxx>                             

         

  •                              
                                       

                                     

                                 

                                 
                                  <#if date_3?date lt jsxx.mainTime?date>                              
                                  new
                                 
                                  ${jsxx.mainTime?string('MM/dd')}

               

  •  

    你可能感兴趣的:(报错,unterminated,string,literal)