1. <head>
  2. <script type="text/javascript">
  3. function split(){
  4. var a = '#7_0_0|0#4_0_0|0#1_2_1|0#2_0_0|0#1_0_0|4#1_3_1|0#1_4_1|0#8_0_0|0#5_0_0|0#3_0
  5. 0|0#6_0_0|0#1_1_1|0#1_5_1|0#1_6_1|0#1_7_1|0#1_8_1|0#1_9_1|0#1_10_1|2#1_11_1|2#1_
  6. 2_1|3#1_13_1|4#1_14_1|3#2_1_1|0#2_2_1|0#2_3_1|0#2_4_1|0#2_5_1|0#2_6_1|0#2_7_1|0#
  7. _8_1|0#2_9_1|0#2_10_1|0#2_11_1|0#2_12_1|0#2_13_1|0#2_14_1|0#2_15_1|0#4_1_1|0#4_2
  8. 1|0#4_3_1|0#6_6_1|0#4_5_1|0#4_6_1|0#4_7_1|0#4_8_1|0#4_9_1|0#4_10_1|0#4_11_1|0#4_
  9. 2_1|0#6_1_1|0#6_3_1|0#6_4_1|0#1_15_1|2#7_1_1|0#7_2_1|0#7_3_1|0#7_4_1|0#7_5_1|0#7
  10. 6_1|0#7_7_1|0#7_8_1|0#7_9_1|0#7_10_1|0#7_11_1|0#5_1_1|0#5_2_1|0#5_3_1|0#5_4_1|0#
  11. _5_1|0#5_6_1|0#5_7_1|0#5_9_1|0#5_8_1|0#5_8_2|0#5_8_3|0#5_8_4|0#5_8_5|0#5_8_6|0#5
  12. 8_7|0#5_8_8|0#5_8_9|0#5_8_10|0#5_8_11|0#5_8_12|0#5_8_13|0#5_10_1|0#3_1_1|0#3_2_1
  13. 0#3_3_1|0#3_4_1|0#3_5_1|0#3_6_1|0#3_7_1|0#3_8_1|0#3_9_1|0#3_10_1|0#8_1_1|0#8_3_1
  14. 0#8_4_1|0#8_6_1|0#8_7_1|0#8_8_1|0#8_9_1|0#8_2_1|0#3_11_1|0#6_7_1|0';
  15. var div = document.getElementById('oDiv');
  16.  
  17.  
  18. var spl = a.split("#");
  19.  
  20. var tab = new Array();
  21. for(var i=0; i<spl.length; i++){
  22. if(spl[i] != ""){
  23. spl2 = spl[i].split('|');
  24. tab[spl2[0]] = spl2[1];
  25. }
  26. }
  27.  
  28. alert(tab.length);
  29.  
  30. for(indeks in tab){
  31. div.innerHTML += tab[indeks] +"<br />";
  32. }
  33.  
  34. }
  35. </script>
  36. </head>
  37. <body onload="split();">
  38. <div id="oDiv"></div>
  39. </body>
  40. </html>


dlaczego alert pokazuje 0 ale petla wyswietla wartosci z tablicy questionmark.gif