我在 Javascript 中有一个 for 循环。我怎样才能给出 i+1 (for 循环中的最后一条语句)?如果我只执行 i+i
,则输出是错误的。
for (var i=0; i<aantal; i++)
{
strOutput += "<p><form action='' method='POST'>";
strOutput += "<input class= 'nummers' type='number' name='aantal' min='1' max='20'>";
strOutput += "<input type='submit' value='In mandje' name= 'toevoegen'>";
strOutput += "<input type='hidden' name='id' value='" + i +"'>";
}
最佳答案
您可以增加边界,因为您在此循环中不使用 i
进行其他操作
for (var i = 1; i <= aantal; i++)
关于javascript - 在for循环中给i+1 javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34452450/