Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> missing ; before statement
lled3
post
Post #1





Grupa: Zarejestrowani
Postów: 91
Pomógł: 0
Dołączył: 7.12.2007

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


Cytat
Błąd: missing ; before statement
Plik źródłowy: ...
Wiersz: 172, Kolumna: 4
Kod źródłowy:
var dane[1] = new Array(10);


[JAVASCRIPT] pobierz, plaintext
  1. function wstaw_dane( id )
  2. {
  3. var dane = new Array();
  4.  
  5.  
  6. var dane[1] = new Array(10);
  7. dane[1][0] = new Array( '', '', '' );
  8. dane[1][1] = new Array( 'Banner', '199', '2' );
  9. dane[1][2] = new Array( 'Banner', '78', '12' );
  10.  
  11. var dane[2] = new Array(10);
  12. dane[2][0] = new Array( '', '', '' );
  13. dane[2][1] = new Array( 'Banner', '199', '2' );
  14. dane[2][2] = new Array( 'Banner', '78', '12' );
  15.  
  16. alert(dane);
  17. for( i=0; i<5; i++ )
  18. {
  19. document.getElementById( 'nazwa[i]' ).value = dane[id][i][nazwa];
  20. document.getElementById( 'ilosc[i]' ).value = dane[id][i][ilosc];
  21. document.getElementById( 'cena[i]' ).value = dane[id][i][cena];
  22. }
  23.  
  24.  
  25.  
  26. }
  27.  
[JAVASCRIPT] pobierz, plaintext

nie wiedzieć czemu zgłasza błąd (IMG:style_emoticons/default/sad.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Fifi209
post
Post #2





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

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


O ile pamiętam w javascript nie podaje się rozmiaru tablicy.

http://www.w3schools.com/JS/js_obj_array.asp

Ten post edytował fifi209 7.07.2010, 14:45:11
Go to the top of the page
+Quote Post
vokiel
post
Post #3





Grupa: Zarejestrowani
Postów: 2 592
Pomógł: 445
Dołączył: 12.03.2007

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


Błąd 1.
[JAVASCRIPT] pobierz, plaintext
  1. var dane[1] = new Array(10);
[JAVASCRIPT] pobierz, plaintext

Można uznać za błąd 2.
[JAVASCRIPT] pobierz, plaintext
  1. var dane = new Array();
  2. var dane[1] = new Array(10);
[JAVASCRIPT] pobierz, plaintext


Powinno być:
[JAVASCRIPT] pobierz, plaintext
  1. var dane = new Array();
  2. dane[1] = new Array();
[JAVASCRIPT] pobierz, plaintext
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: 6.10.2025 - 01:05