responseText like" insert-90RS252,insert-90RS262,insert-90RS232"
function(responseText) {
var res = responseText.split(",");
for (var i = 0; i < res.length; i++) {
var res2 = res[i].split("-");
if (res2[0] === "insert") {
alert(res2[0] + i);
}
}
}
警报时: insert1和insert2 不要从第0步开始。请帮助。
答案 0 :(得分:0)
if(res2[0]==="insert")
应为if(res2[1]==="insert")
因为&#39;插入&#39;将是res2数组中的第二个元素。
答案 1 :(得分:0)
正在努力......
var Text = "insert-90RS252,insert-90RS262,insert-90RS232";
var res = Text.split(",");
for (var i = 0; i < res.length; i++) {
var res2 = res[i].split("-");
if (res2[0].trim() === "insert") {
alert(res2[0] + i);
}
}