【问题标题】:Simple javascript string problem in ie6 and ie7ie6和ie7中的简单javascript字符串问题
【发布时间】:2010-03-26 19:14:19
【问题描述】:

我有一个非常简单的函数,它采用逗号分隔的 (x,y) 点列表并将它们导入到图表中。我安装了 FF、Chrome 和 IE8。我使用 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;
    }
    ...

在 Chrome、FF 和 IE8 中,我看不到“After if:”警报。 在 IE6 和 IE7 中,我看到以下两个警报: 数据在:(52,16),(100,90) 之后 if: undefined undefined

“数据输入”警报在所有浏览器中都匹配。

有什么想法吗?

【问题讨论】:

  • 数据是字符串还是数组?

标签: javascript arrays string internet-explorer-6 internet-explorer-7


【解决方案1】:

想通了。必须使用 .charAt() 而不是在 ie6 和 7 中将字符串视为数组。

【讨论】:

    猜你喜欢
    • 2010-10-20
    • 2011-03-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多