所以从一些代码开始:
JS:
function showTest(nrOdp) {
if (nrOdp < arrLen - 1) {
div.innerHTML = "<form action='check.php' method='post'><div class='card-panel col s12 black-text'><p>" + testName.pytania[nrOdp].pytanie + "</p></div> <label> <div class='card-panel col s6'> <p> <input class='with-gap' name='odp' type='radio'/> <span>" + testName.pytania[nrOdp].odpowiedz_a + "</span> </p> </div> </label> <label> <div class='card-panel col s6'> <p> <input class='with-gap' name='odp' type='radio'/> <span>" + testName.pytania[nrOdp].odpowiedz_b + "</span> </p> </div> </label> <label> <div class='card-panel col s6'> <p> <input class='with-gap' name='odp' type='radio'/> <span>" + testName.pytania[nrOdp].odpowiedz_d + "</span> </p> </div> </label> <label> <div class='card-panel col s6'> <p> <input class='with-gap' name='odp' type='radio'/> <span>" + testName.pytania[nrOdp].odpowiedz_c + "</span> </p> </div> </label><div class='col s6'><input class='btn center' type='submit' onclick='showTest(" + (nrOdp + 1) + ")' value='Następne'></div></form>";
} else if (nrOdp <= arrLen - 1) {
div.innerHTML = "<form action='check.ph' method='post'><div class='card-panel col s12 black-text'><p>" + testName.pytania[nrOdp].pytanie + "</p></div> <label> <div class='card-panel col s6'> <p> <input class='with-gap' name='odp' type='radio'/> <span>" + testName.pytania[nrOdp].odpowiedz_a + "</span> </p> </div> </label> <label> <div class='card-panel col s6'> <p> <input class='with-gap' name='odp' type='radio'/> <span>" + testName.pytania[nrOdp].odpowiedz_b + "</span> </p> </div> </label> <label> <div class='card-panel col s6'> <p> <input class='with-gap' name='odp' type='radio'/> <span>" + testName.pytania[nrOdp].odpowiedz_d + "</span> </p> </div> </label> <label> <div class='card-panel col s6'> <p> <input class='with-gap' name='odp' type='radio'/> <span>" + testName.pytania[nrOdp].odpowiedz_c + "</span> </p> </div> </label><div class='col s6'><input type='submit' class='btn center' onclick='timerState(false)' value='Zakończ'></div></form>";
}
}
现在我的意思是, 该脚本显示了第一个元素,在哪里给出了php代码的“Następne”,但是单击此按钮后什么也没有发生,而当最后一个元素显示在“Zakończ”时,则表明该php代码已经在运行,每次我单击“Następne”按钮时都想使它执行php代码