我正在使用搜索功能在字符串中搜索匹配项,比如下面的 JS ......比如说,找到了第一个结果,嗯.......找到了第二个,嗯....第三个 id 没有找到,然后控制/光标退出循环,我的意思是,循环立即终止,我认为 ELSE 条件将触发并继续迭代直到长度结束......但在中间它终止!请。建议我修复或提供新的 JS,谢谢
// OriginalFields is a string, its fillled with fields list with space seperator
myArrayGrey = greyFields.split(" ");
for (var i = 0; i < myArrayGrey.length; i++) {
var returnValue = OriginalFields.search(myArrayGrey[i]);
if (returnValue != -1) {
//grey the field
// and
// make access = "readOnly";
};
else {;
// do nothing
// just for my testing am doing app.alert (not found)
};
};