开发者

How do I add another sibling element in e4x?

If I want to create:

<foo>
  <bar>example1开发者_StackOverflow社区</bar>
  <bar>example2</bar>
</foo>

using e4x, and I already have:

foo.bar = <bar>example1</bar>

How do I add the additional bar tag?


You either write another literal,

foo += <bar>example3</bar> ;

or you use the relevant methods: http://www.ibm.com/developerworks/library/x-javascript4x.html (Table-1),

var addition = <bar>example3</bar>
foo.insertChildAfter(foo.bar[1],addition) ;

HTH

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜