[COLOR=#333130][FONT=tahoma]ich habe hier ein echt dummes Problem, was ich nicht verstehe.. ich versuche ein array in einer Schleife Auszugeben und verwende dafür eine Zähl variable.. leider bekomme ich immer den Fehler "TypeError: img_pre_array[i] is undefined"[/FONT][/COLOR]
[COLOR=#333130][FONT=tahoma]Wenn anstatt das i direkt eine Zahl eintrage, funktioniert es komischerweise!!!?!?[/FONT][/COLOR]
[COLOR=#333130][FONT=tahoma]PHP Quellcode:
[COLOR=#333130][FONT=tahoma]was mache ich denn falsch, das "i" nicht als Zahl erkannt wird??[/FONT][/COLOR]
[COLOR=#333130][FONT=tahoma]Wenn anstatt das i direkt eine Zahl eintrage, funktioniert es komischerweise!!!?!?[/FONT][/COLOR]
[COLOR=#333130][FONT=tahoma]PHP Quellcode:
[COLOR=#1818E3][FONT=monospace][COLOR=#007700]var[/COLOR] i [COLOR=green]=[/COLOR] [COLOR=#007700]0[/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]while[/COLOR][COLOR=green]([/COLOR]i [COLOR=green]<=[/COLOR] img_pre_array[COLOR=green].[/COLOR]length[COLOR=green])[/COLOR]
[COLOR=green]{[/COLOR]
[COLOR=#007700]var[/COLOR] id [COLOR=green]=[/COLOR] img_pre_array[COLOR=green][[/COLOR]i[COLOR=green]][/COLOR][COLOR=green][[/COLOR][COLOR=#DD0000]"id"[/COLOR][COLOR=green]][/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]var[/COLOR] img_width [COLOR=green]=[/COLOR] img_pre_array[COLOR=green][[/COLOR]i[COLOR=green]][/COLOR][COLOR=green][[/COLOR][COLOR=#DD0000]"img_width"[/COLOR][COLOR=green]][/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]var[/COLOR] img_height [COLOR=green]=[/COLOR] img_pre_array[COLOR=green][[/COLOR]i[COLOR=green]][/COLOR][COLOR=green][[/COLOR][COLOR=#DD0000]"img_height"[/COLOR][COLOR=green]][/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]var[/COLOR] img_url [COLOR=green]=[/COLOR] img_pre_array[COLOR=green][[/COLOR]i[COLOR=green]][/COLOR][COLOR=green][[/COLOR][COLOR=#DD0000]"img_url"[/COLOR][COLOR=green]][/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]if[/COLOR][COLOR=green]([/COLOR]img_height [COLOR=green]>=[/COLOR] [COLOR=#007700]150[/COLOR] [COLOR=green]&&[/COLOR] img_width [COLOR=green]>=[/COLOR] [COLOR=#007700]150[/COLOR][COLOR=green])[/COLOR]
[COLOR=green]{[/COLOR]
[COLOR=#007700]var[/COLOR] row[COLOR=green]=[/COLOR][COLOR=green]{[/COLOR][COLOR=green]}[/COLOR][COLOR=green];[/COLOR]
row[COLOR=green].[/COLOR]id [COLOR=green]=[/COLOR] id[COLOR=green];[/COLOR]
row[COLOR=green].[/COLOR]img_width [COLOR=green]=[/COLOR] img_width[COLOR=green];[/COLOR]
row[COLOR=green].[/COLOR]img_height [COLOR=green]=[/COLOR] img_height[COLOR=green];[/COLOR]
row[COLOR=green].[/COLOR]img_url [COLOR=green]=[/COLOR] img_url[COLOR=green];[/COLOR]
img_array[COLOR=green].[/COLOR]push[COLOR=green]([/COLOR]row[COLOR=green])[/COLOR][COLOR=green];[/COLOR]
[COLOR=green]}[/COLOR]
i[COLOR=green]++;[/COLOR]
[COLOR=green]}[/COLOR][/FONT][/COLOR]
[/FONT][/COLOR][COLOR=#007700]while[/COLOR][COLOR=green]([/COLOR]i [COLOR=green]<=[/COLOR] img_pre_array[COLOR=green].[/COLOR]length[COLOR=green])[/COLOR]
[COLOR=green]{[/COLOR]
[COLOR=#007700]var[/COLOR] id [COLOR=green]=[/COLOR] img_pre_array[COLOR=green][[/COLOR]i[COLOR=green]][/COLOR][COLOR=green][[/COLOR][COLOR=#DD0000]"id"[/COLOR][COLOR=green]][/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]var[/COLOR] img_width [COLOR=green]=[/COLOR] img_pre_array[COLOR=green][[/COLOR]i[COLOR=green]][/COLOR][COLOR=green][[/COLOR][COLOR=#DD0000]"img_width"[/COLOR][COLOR=green]][/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]var[/COLOR] img_height [COLOR=green]=[/COLOR] img_pre_array[COLOR=green][[/COLOR]i[COLOR=green]][/COLOR][COLOR=green][[/COLOR][COLOR=#DD0000]"img_height"[/COLOR][COLOR=green]][/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]var[/COLOR] img_url [COLOR=green]=[/COLOR] img_pre_array[COLOR=green][[/COLOR]i[COLOR=green]][/COLOR][COLOR=green][[/COLOR][COLOR=#DD0000]"img_url"[/COLOR][COLOR=green]][/COLOR][COLOR=green];[/COLOR]
[COLOR=#007700]if[/COLOR][COLOR=green]([/COLOR]img_height [COLOR=green]>=[/COLOR] [COLOR=#007700]150[/COLOR] [COLOR=green]&&[/COLOR] img_width [COLOR=green]>=[/COLOR] [COLOR=#007700]150[/COLOR][COLOR=green])[/COLOR]
[COLOR=green]{[/COLOR]
[COLOR=#007700]var[/COLOR] row[COLOR=green]=[/COLOR][COLOR=green]{[/COLOR][COLOR=green]}[/COLOR][COLOR=green];[/COLOR]
row[COLOR=green].[/COLOR]id [COLOR=green]=[/COLOR] id[COLOR=green];[/COLOR]
row[COLOR=green].[/COLOR]img_width [COLOR=green]=[/COLOR] img_width[COLOR=green];[/COLOR]
row[COLOR=green].[/COLOR]img_height [COLOR=green]=[/COLOR] img_height[COLOR=green];[/COLOR]
row[COLOR=green].[/COLOR]img_url [COLOR=green]=[/COLOR] img_url[COLOR=green];[/COLOR]
img_array[COLOR=green].[/COLOR]push[COLOR=green]([/COLOR]row[COLOR=green])[/COLOR][COLOR=green];[/COLOR]
[COLOR=green]}[/COLOR]
i[COLOR=green]++;[/COLOR]
[COLOR=green]}[/COLOR][/FONT][/COLOR]
[COLOR=#333130][FONT=tahoma]was mache ich denn falsch, das "i" nicht als Zahl erkannt wird??[/FONT][/COLOR]
Kommentar