0
ctv.currentdate = new Date(ctv["current"]["@attributes"].attr);

页面在 Chrome 中就像一个魅力,但 Firefox、IE10 和 Safari 都不起作用。Firefox 控制台返回以下消息:

TypeError: ctv.current['@attributes'] is undefined

如果我这样做console.log(ctv["current"]["@attributes"]);,Firefox 会返回undefined,而 Chrome 会返回一个实际值,即。Object {attr: "2013-7-28"}.

想法?

4

1 回答 1

3

Chrome 支持“@”,但这在 ES5 中技术上是不允许的。很好读: http: //mathiasbynens.be/notes/javascript-identifiers

很酷的验证器(如果您想进一步探索): http: //mothereff.in/js-variables

于 2013-07-28T06:12:25.367 回答