Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wyświetlanie zawartości tablicy JS
david8213
post 25.11.2018, 10:49:31
Post #1





Grupa: Zarejestrowani
Postów: 308
Pomógł: 0
Dołączył: 9.12.2009

Ostrzeżenie: (10%)
X----


Jak wyswietlić dane z tablicy na stronie.
Poniżej nie działa

  1. <script>
  2.  
  3. const tab = [];
  4. tab[0] = ['standardowa' , '200', '4', '955,07', '36x36', '43'];
  5. tab[1] = ['standardowa' , '180', '5', '1083,67', '36x36', '43'];
  6. tab[2] = ['standardowa' , '160', '6', '1212,27', '36x36', '43'];
  7.  
  8. console.log('TYP: ' + tab[0][0] + ', srednica: ' + tab[0][1] + ', dlugosc: ' + tab[0][2]+ ', cena: ' + tab[0][3]);
  9. console.log('TYP: ' + tab[1][0] + ', srednica: ' + tab[1][1] + ', dlugosc: ' + tab[1][2] + ', cena: ' + tab[1][3]);
  10. console.log('TYP: ' + tab[2][0] + ', srednica: ' + tab[2][1] + ', dlugosc: ' + tab[2][2] + ', cena: ' + tab[2][3]);
  11.  
  12. </script>



  1. <script type="text/javascript">
  2.  
  3. var tab = [];
  4. tab[0] = ["standardowa" , "200", "4", "955,07", "36x36", "43"];
  5. tab[1] = ["standardowa" , "180", "5", "1083,67", "36x36", "43"];
  6. tab[2] = ["standardowa" , "160", "6", "1212,27", "36x36", "43"];
  7.  
  8. document.write("TYP: " + tab[0][0] + ", srednica: " + tab[0][1] + ", dlugosc: " + tab[0][2]+ ", cena: " + tab[0][3]);
  9. document.write("TYP: " + tab[1][0] + ", srednica: " + tab[1][1] + ", dlugosc: " + tab[1][2] + ", cena: " + tab[1][3]);
  10. document.write("TYP: " + tab[2][0] + ", srednica: " + tab[2][1] + ", dlugosc: " + tab[2][2] + ", cena: " + tab[2][3]);
  11.  
  12. </script>


Ten post edytował david8213 25.11.2018, 10:56:31
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
david8213
post 26.11.2018, 22:11:55
Post #2





Grupa: Zarejestrowani
Postów: 308
Pomógł: 0
Dołączył: 9.12.2009

Ostrzeżenie: (10%)
X----


Nie musi się zamieniać w kurs ale przykład mógłby ktoś podać ...
Go to the top of the page
+Quote Post

Posty w temacie


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 Wersja Lo-Fi Aktualny czas: 27.04.2024 - 20:42