1 回答
TA贡献1770条经验 获得超3个赞
function f(jsons, num) {
var num8 = num.substr(0, 8);
var num6 = num.substr(0, 6);
var result = '';
var inArr = 0;
for (var i = 0, len = jsons.length; i < len; i++) {
var id = jsons[i].id;
if (id == num8) {
result8 = jsons[i].info.toString();
$("#card_info").fadeIn("500");
$("#close").fadeIn("500");
inArr++;
break;
}
if (id == num6) {
result6 = jsons[i].info.toString();
$("#card_info").fadeIn("500");
$("#close").fadeIn("500");
inArr++;
}
}
!inArr && alert("不符合条件");
return result8 ? result8 : result6;
}
添加回答
举报