开发者

class as an element in an object

hi I am trying to read html to get some data fro开发者_JAVA技巧m yahoo stock, and I want to read what the class is. so here is what I have

data.query.results.span[0].strong.class

my problem is javascript doesn't like class there and takes it as a special key word or something

when I do data.query.results.span[0].strong.content it works fine.

Strong has 2 elements inside first class second content.

is there a way to make java look at class as in element in that json object rather than a keyword?

thank you


Use the bracket notation.

data.query.results.span[0].strong['class']

class is a reserved future keyword, and will bomb out in most modern browsers now. I know Safari doesn't like it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜