Safari Javascript parent.frames.length

Posted by Engwan on Stack Overflow See other posts from Stack Overflow or by Engwan
Published on 2010-03-17T14:01:13Z Indexed on 2010/03/17 14:31 UTC
Read the original article Hit count: 401

Filed under:
|
|

I get a parse error from Safari with this code:

for (var i=0; i<parent.frames.length; i++){...}

doing

alert(parent.frames.length);

works and outputs the correct value which is 5.

I also tried but failed:

var len = parent.frames.length
alert(len); //Correct
for (var i=0; i<len; i++){...} //Parse Error

When i type this code into the console directly, it works fine. And it also works fine in other browsers.

What seems to be the problem?

© Stack Overflow or respective owner

Related posts about safari

Related posts about JavaScript