Thursday, January 28, 2010
IE7 javascript error in for each loops
One of the reasons I like Flash is the fact that one piece of code will work on every browser. But not so with javascript. Case in point:
If you have an array (langArray) in javascript and want to loop through it the common way is this:
for each(var item in langArray){
...
}
but this causes IE 7 to choke. Instead you have to use the more verbose:
for(var item=0;item
var item = langArray[i];
...
}
No comments:
Post a Comment
‹
›
Home
View web version
No comments:
Post a Comment