<html> <head> <script type="text/javascript"> function split(){ 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 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_ 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# _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 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_ 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 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# _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 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 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 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'; var div = document.getElementById('oDiv'); var spl = a.split("#"); var tab = new Array(); for(var i=0; i<spl.length; i++){ if(spl[i] != ""){ spl2 = spl[i].split('|'); tab[spl2[0]] = spl2[1]; } } alert(tab.length); for(indeks in tab){ div.innerHTML += tab[indeks] +"<br />"; } } </script> </head> <body onload="split();"> </body> </html>
dlaczego alert pokazuje 0 ale petla wyswietla wartosci z tablicy
