JS - 字符串显示相应长度

/* 
 * str:字符串
 * num:显示位数
 */
function opStr(str, num){
    var str1 = str;
    var str2 = '';
    if(str1.length>num){
        str2 = str1.substring(0, num) + '..';
    }else{
    str2 = str1;
    }
    return str2;
}

CSS, JS - version

<link 
    rel="stylesheet" 
    href="../resources/css/style.css?version=<?php echo filemtime('../resources/js/login.php.js');?>">
<script 
    type="text/javascript" 
    src="../resources/js/login.php.js?version=<?php echo filemtime('../resources/js/login.php.js)';?>">
</script>

  翻  牌  子