IF语句用于选择具有某些属性值的节点 [英] IF statement to select nodes w/certain attribute values

查看:87
本文介绍了IF语句用于选择具有某些属性值的节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试为这个javascript添加一个IF语句,它将选择/只显示具有某个属性或属性值的那些xml节点。


这是'我的xml代码:

Hi,
I''m trying to add an IF statement to this javascript that will select/display only those xml nodes either with a certain attribute or attribute value.

Here''s my xml code:

展开 | 选择 | Wrap | 行号

推荐答案

我不知道这是否符合您的要求,但您可以使用这个例子
I don''t know if this will do what you want, but you could work with this example.


不完全......

对不起我sh我应该更清楚我要试图让这个剧本去做什么。我希望让它通过xml文件并仅显示某个时区中的那些城市(或频率)。


我是否设置了错误的xml?我应该将时区作为< station>的另一个子元素吗?而是作为< station> ;?的属性这会让我更容易想出一个可以解决这个问题的JavaScript吗?

Not exactly...
Sorry I should have been more clear on what I''m trying to get this script to do. I was hoping to have it go through the xml file and display only those cities (or frequencies) that are in a certain timezone.

Do I have the xml set up wrong? Should I put the timezone as another child element of <station> instead as an attribute of <station>? Would that make it easier to come up with a javascript that can sort that out?

Thanks, every little bit helps since I''m new to xml and still fairly new to javascript.



不完全是......

对不起我应该更清楚我在尝试什么得到这个脚本。我希望让它通过xml文件并仅显示某个时区中的那些城市(或频率)。


我是否设置了错误的xml?我应该将时区作为< station>的另一个子元素吗?而是作为< station> ;?的属性这会让我更容易想出一个可以解决这个问题的JavaScript吗?

Not exactly...
Sorry I should have been more clear on what I''m trying to get this script to do. I was hoping to have it go through the xml file and display only those cities (or frequencies) that are in a certain timezone.

Do I have the xml set up wrong? Should I put the timezone as another child element of <station> instead as an attribute of <station>? Would that make it easier to come up with a javascript that can sort that out?

Thanks, every little bit helps since I''m new to xml and still fairly new to javascript.



是的,也许这应该可以解决你的问题。 xml只是一个示例,还是您期望多个站点具有相同的时区?也许你可以在XML论坛中询问这个问题的XML元素吗?

Yes, perhaps that should solve your problem. Is the xml just an example or do you expect that multiple stations will have the same timezone? Perhaps you could ask about the XML element of this problem in the XML forum?


这篇关于IF语句用于选择具有某些属性值的节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆