Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem z Pętlą.
DamianRastMan
post
Post #1





Grupa: Zarejestrowani
Postów: 26
Pomógł: 2
Dołączył: 3.04.2015

Ostrzeżenie: (0%)
-----


  1. <script>
  2. for (var number=99; number != 0; number-- )
  3. {
  4. var nextnumber = number-1;
  5. if(number > 2)
  6. {
  7. document.write("is "+number+" bottles of beer on the wall."+number+" bottles of beer. Take one down and pass it around - "+nextnumber+" bottles of beer on the wall. <br />");
  8. }
  9. else if(number = 2)
  10. {
  11. document.write("is "+number+" bottles of beer on the wall."+number+" bottles of beer. Take one down and pass it around - "+nextnumber+" bottle of beer on the wall. <br />");
  12. }
  13. else if(number = 1)
  14. {
  15. document.write("is "+number+" bottles of beer on the wall."+number+" bottle of beer. Take it down and pass it around - no more bottles of beer on the wall. <br />");
  16. }
  17. }
  18. </script>


Witam, dziś jest mój pierwszy dzień z JavaScript, wcześniej maczałem już palce w php i pewnie stąd mój bak zrozumienia... no więc.. Chciałbym aby ten kawałek kodu, wyświetlał mi znaną, szkocką, barową piosenkę: https://pl.wikipedia.org/wiki/99_Bottles_of_Beer, jednak niestety pojawia mi się tutaj problem.. i nie mogę dość, co to takiego? Będę bardzo wdzięczny za pomoc (IMG:style_emoticons/default/smile.gif)

Okej, rozwiązany... problem tkwił w operatorze porównania... = zamiast == (IMG:style_emoticons/default/smile.gif)

Ten post edytował DamianRastMan 14.01.2016, 19:57:54
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 2.10.2025 - 22:44