cssQuery()的下載與使用方法
更新時間:2007年01月12日 00:00:00 作者:
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
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
相關文章
firefox下jquery iframe刷新頁面提示會導致重復之前動作
刷新頁面會提示要顯示此頁面, Firefox 必須發(fā)送將會導致重復之前動作的數(shù)據(jù),此問題很是疑惑,接下來將為您解答,需要的朋友可以了解下2012-12-12jquery實現(xiàn)類似EasyUI的頁面布局可改變左右的寬度
這篇文章主要介紹了通過jquery實現(xiàn)類似EasyUI的頁面布局可改變左右的寬度,需要的朋友可以參考下2014-07-07jquery實現(xiàn)漫天雪花飛舞的圣誕祝福雪花效果代碼分享
這篇文章主要介紹了jquery實現(xiàn)漫天雪花飛舞的圣誕祝福雪花效果,很浪漫,感興趣的小伙伴們可以參考一下2015-08-08jQuery EasyUI API 中文文檔 - Dialog對話框
jQuery EasyUI API 中文文檔 - Dialog對話框使用說明,需要的朋友可以參考下。2011-11-11JQueryEasyUI之DataGrid數(shù)據(jù)顯示
在有的項目中,為了方便將數(shù)據(jù)庫中的某些定值儲存為指定的數(shù)字,怎么處理這種問題呢?下面小編通過一段代碼給大家介紹下,需要的朋友參考下2016-11-11