开发者

Safari Javascript parent.frames.length

开发者 https://www.devze.com 2022-12-23 19:00 出处:网络
I get a parse error from Safari with this code: for (var i=0; i<parent.frames.length; i++){...} doing

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?


I found a way to make it work, i just added a space after <.

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

But i'm still stumped as to why the one without a space gives a parse error.

0

精彩评论

暂无评论...
验证码 换一张
取 消