[英]Simple javascript string problem in ie6 and ie7
I have a very simple function that takes a list of comma separated (x,y) points and imports them into a graph. 我有一个非常简单的函数,它接受逗号分隔(x,y)点的列表并将它们导入图形。 I have FF, Chrome and IE8 installed.
我安装了FF,Chrome和IE8。 I use IETester to test for IE6 and IE7.
我使用IETester来测试IE6和IE7。
// Import Data
this.Import = function(data) {
alert("Data in: "+data);
var d;
// Make sure the first and the last are start/ending parenthesis
if ( (data[0] != '(') || (data[data.length-1] != ')') ) {
alert("After if: "+data[0]+" "+data[data.length-1]);
return false;
}
...
In Chrome, FF and IE8, I don't see the "After if:" alert. 在Chrome,FF和IE8中,我没有看到“After if:”警报。 In IE6 and IE7, I see the following two alerts: Data in: (52,16),(100,90) After if: undefined undefined
在IE6和IE7中,我看到以下两个警告:数据输入:(52,16),(100,90)之后if:undefined undefined
The "Data in" alert matches in all browsers. “数据输入”警报在所有浏览器中都匹配。
Any ideas? 有任何想法吗?
Figured it out. 弄清楚了。 Have to use .charAt() instead of treating a string as an array in ie6 and 7.
必须使用.charAt()而不是将字符串视为ie6和7中的数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.