cssQuery()的下载与使用方法
2007-01-12 00:00
549 查看
Introduction
cssQuery() is a powerful cross-browser JavaScript function that enables querying of a DOM document using CSS selectors. All CSS1 and CSS2 selectors are allowed plus quite a few CSS3 selectors.
Usage
Syntax
elements = cssQuery(selector [, from]);where selector (required) is a valid CSS selector and from (optional) is a document, element or array of elements which is filtered by selector.
The function returns a JavaScript array of elements. If there is no match, an empty array is returned.
Some examples:
// find all paragraphs that are direct descendants// of the document bodyvar tags = cssQuery("body > p");// find all elements with the "href" attributevar tags = cssQuery("[href]");// find all anchor elements with "href" equal to "#"var tags = cssQuery("a[href='#']");// find all images contained by the above anchorsvar images = cssQuery("img", tags);// find all listsvar tags = cssQuery("dl,ol,ul");// query an external xml documentvar tags = cssQuery("my|:root>my|link", myXMLDoc);// just plain complicatedvar complex = "p>a:first-child+input[type=text]~span";var tags = cssQuery(complex);Allowed Selectors
*
E
E F
E > F
E + F
E ~ F
E.warning
E#myid
E:link
E:first-child
E:last-child
E:nth-child(n)
E:nth-last-child(n)
E:only-child
E:root
E:lang(fr)
E:target
E:enabled
E:disabled
E:checked
E:contains("foo")
E:not(s)
E[foo]
E[foo="bar"]
E[foo~="bar"]
E[foo^="bar"]
E[foo$="bar"]
E[foo*="bar"]
E[foo|="bar"]
Compatibility
Known to work on the following platforms:
Microsoft Internet Explorer 5+ (Windows)
Microsoft Internet Explorer 5.2 (Mac)
Firefox/Mozilla 1.6+
Opera 7+
Netscape 6+
Safari 1.2
Source Code
cssQuery.js
cssQuery-level2.js
cssQuery-level3.js
cssQuery-standard.js
cssQuery() is a powerful cross-browser JavaScript function that enables querying of a DOM document using CSS selectors. All CSS1 and CSS2 selectors are allowed plus quite a few CSS3 selectors.
Usage
Syntax
elements = cssQuery(selector [, from]);where selector (required) is a valid CSS selector and from (optional) is a document, element or array of elements which is filtered by selector.
The function returns a JavaScript array of elements. If there is no match, an empty array is returned.
Some examples:
// find all paragraphs that are direct descendants// of the document bodyvar tags = cssQuery("body > p");// find all elements with the "href" attributevar tags = cssQuery("[href]");// find all anchor elements with "href" equal to "#"var tags = cssQuery("a[href='#']");// find all images contained by the above anchorsvar images = cssQuery("img", tags);// find all listsvar tags = cssQuery("dl,ol,ul");// query an external xml documentvar tags = cssQuery("my|:root>my|link", myXMLDoc);// just plain complicatedvar complex = "p>a:first-child+input[type=text]~span";var tags = cssQuery(complex);Allowed Selectors
*
E
E F
E > F
E + F
E ~ F
E.warning
E#myid
E:link
E:first-child
E:last-child
E:nth-child(n)
E:nth-last-child(n)
E:only-child
E:root
E:lang(fr)
E:target
E:enabled
E:disabled
E:checked
E:contains("foo")
E:not(s)
E[foo]
E[foo="bar"]
E[foo~="bar"]
E[foo^="bar"]
E[foo$="bar"]
E[foo*="bar"]
E[foo|="bar"]
Compatibility
Known to work on the following platforms:
Microsoft Internet Explorer 5+ (Windows)
Microsoft Internet Explorer 5.2 (Mac)
Firefox/Mozilla 1.6+
Opera 7+
Netscape 6+
Safari 1.2
Source Code
cssQuery.js
cssQuery-level2.js
cssQuery-level3.js
cssQuery-standard.js
相关文章推荐
- cssQuery()的下载与使用方法
- pthread_mutexattr_setpshared使用man 查询不到安装包下载方法,以及VIM性感插件
- iOS开发——网络篇——NSURLSession,下载、上传代理方法,利用NSURLSession断点下载,AFN基本使用,网络检测,NSURLConnection补充
- ARP攻击原理及解决方法(NBTSCAN扫描工具下载和nbtscan使用方法)
- Android 手机卫士--xutils说明与下载方法使用
- Resharper 下载及使用方法
- 谈谈Android下载图片的方法中SoftReference的使用
- Linux 使用wget 命令下载JDK的方法
- Xcode5.1离线下载安装及使用iOS5模拟器进行开发调试的方法
- vs2008中文正式版使用安装方法及下载
- Android Studio使用远程依赖时下载不了jar包的解决方法
- MFC学习之 皮肤使用方法 + 代码 + 下载地址
- 使用wget下载jdk方法
- STM32F103程序设计-2-使用STLINK下载程序的两种方法
- 手动下载Win8语言包使其可以离线使用的方法
- Bytescout Spreadsheet SDK for.NET下载及使用方法
- 使用FileZilla从Linux系统下载文件的方法
- 迅雷离线下载怎么使用?迅雷离线下载使用方法
- 在android中使用AsyncTask从网络中下载图片,但是调用了execute方法后,最后不执行onPostExcute方法