当前位置:首页 > 代码片段

JS对返回字符串转的处理

时间:2023-01-19 | 栏目:代码片段 | 围观热度:2

1、JQ分割字符串为数组:

var give_strs= new Array(); //定义一数组
give_strs=result.split("|"); //字符分割 
if (give_strs[0]=="0"){
}

或者

for (i=0;i<give_strs.length;i++){
}

2、JS判断是否存在字符串:

if (result.indexOf("正确") >= 0){
    $("#nowtel").html('111');
}