如何在 YUI3 中使用查找功能?以及如何找到元标记列表? [英] How to use find function in YUI3? And how to find meta tag list?

查看:23
本文介绍了如何在 YUI3 中使用查找功能?以及如何找到元标记列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像jQuery一样,我们可以收集类'anything'
的匹配DOM元素的数组借助'查找'功能
我可以在 YUI3 中使用相同的功能吗?

Like jQuery we can collect the array of matched DOM element of class 'anything'
with the help of 'find' function
Can i have same functionality in YUI3?

编辑 1:

因为我在 php 'file_get_content' 函数的帮助下有网站源代码
我想通过 YUI3 找到元标记列表.

As i have website source code with the help of php 'file_get_content' function
and i want to find the list of meta tag by YUI3.

这里我使用了名为
的模块1. io-base : 以ajax方式获取网站源码
2. 节点:通过代码实现功能.

Here i used module named
1. io-base : to get the website source code in ajax mode
2. node : to implement functionality over code.

我可以知道如何解析 responseText 以获取元标记列表吗?

May i know how to parse the responseText to get the list of meta tag?

推荐答案

你可以像这样找到所有匹配元素的集合.

You can find the collection of all matched elements like this.

YUI().use('node', function(Y){
var myElements = Y.all('.classname');
});

如果您使用的是 io 模块,用户指南可能会有所帮助.

If you are using the io module the user guides may help.

如果您的响应格式类似于 json,您将包含 json 模块并将 responseText 解析为 json,然后将其视为一个对象.如果返回的是 xml,则使用通过 io 调用返回的 responseXML 并使用本机 xml dom 函数.(用户指南中链接的示例仅展示了此类工作)

if the format of your response is something like json, you would include the json module and parse the responseText to json and then just treat it as an object. If it's xml that you get back use the responseXML returned via the io call and use the native xml dom functions. (The examples linked on the user guide shows just this type of work)

此外,如果您习惯使用 jQuery,请尝试 rosettastone 站点

Also, if you are used to jQuery try the rosettastone site

这篇关于如何在 YUI3 中使用查找功能?以及如何找到元标记列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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