kod javascript szybka odpowiedź [zamknięte]
Dlaczego to nie działa? Próbuję teraz przez długi czas i wydaje się, że nie ma końca. Musisz to uprościć jak to tylko możliwe
var firstInput = document.luckForm.numberBox.value;
var secondInput = document.luckForm.numberBox2.value;
var thirdInput = document.luckForm.numberBox3.value;
for (firstInput = 0; firstInput <= 10; firstInput++) {
if (firstInput = luckyNumber) {
if (secondInput = luckyNumber2) {
if (thirdInput = luckyNumber3) {
{alert('Congratulations! You got all 3 numbers correct. You\'ve won £1000!'); }}}}}
Próbowałem zmienić ten kod (patrz poniżej) na kod pętli for, bardzo prosty bez tablic. Nie jestem pewien, jak mogę to zrobić. To ma być loteria, możesz wpisać trzy liczby, a jeśli są poprawne, otrzymasz wiadomość, że wygrywasz 1000 funtów.
if (firstInput == luckyNumber && secondInput == luckyNumber2 && thirdInput == luckyNumber3 || firstInput == luckyNumber && secondInput == luckyNumber3 && thirdInput == luckyNumber2 || firstInput == luckyNumber2 && secondInput == luckyNumber3 && thirdInput == luckyNumber || firstInput == luckyNumber2 && secondInput == luckyNumber && thirdInput == luckyNumber3 || firstInput == luckyNumber3 && secondInput == luckyNumber && thirdInput == luckyNumber2 || firstInput == luckyNumber3 && secondInput == luckyNumber2 && thirdInput == luckyNumber)
{
alert('Congratulations! You got all 3 numbers correct. You\'ve won £1000!');