当前位置: 代码迷 >> Web前端 >> 在firefox上犯的一个数组定义异常,不支持location作为数组名
  详细解决方案

在firefox上犯的一个数组定义异常,不支持location作为数组名

热度:86   发布时间:2012-10-28 09:54:44.0
在firefox下犯的一个数组定义错误,不支持location作为数组名

源代码如下:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<script type="text/javascript">
var location = new Array(["AF"],["AL"]);
alert(location.length);

</script>
<body>
</body>
</html>

?

在firefox打不开,但在ie下正常,以为是firefox是不能这样定义数组,瞪眼半天也没有发现错误,后来随便改了一个数组名就可以.

  相关解决方案