1. 程式人生 > >js util字串包含

js util字串包含

/js方法相關方法總結

//樹選擇,需選擇到子節點

function check() {
    var node2 = $('#tree').tree('getSelected');


    if (node2 != null) {
        var l = node2.attributes.l;
        if (l != "2") {//一級 電壓等級
            $.messager.alert("系統提示", "請選擇試卷系統編號統計!", "info");
            return ;
        }
        var childrens = $(this).tree("getChildren", node2.target);
        if (childrens.length != 0) {
            return false;
        }
        else {
            //console.log(node2.id);
            return node2.id;
        }
    }
}

//字串包含校驗

// 使用   if(data.te_status!="0"&&(!isContains((data.te_hasuser),'${loginUser.su_id}')))

   function isContains(str, substr) {
    return new RegExp(substr).test(str);
}