cssQuery()的下載與使用方法
更新時(shí)間: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
相關(guān)文章
firefox下jquery iframe刷新頁(yè)面提示會(huì)導(dǎo)致重復(fù)之前動(dòng)作
刷新頁(yè)面會(huì)提示要顯示此頁(yè)面, Firefox 必須發(fā)送將會(huì)導(dǎo)致重復(fù)之前動(dòng)作的數(shù)據(jù),此問(wèn)題很是疑惑,接下來(lái)將為您解答,需要的朋友可以了解下2012-12-12jquery實(shí)現(xiàn)類(lèi)似EasyUI的頁(yè)面布局可改變左右的寬度
這篇文章主要介紹了通過(guò)jquery實(shí)現(xiàn)類(lèi)似EasyUI的頁(yè)面布局可改變左右的寬度,需要的朋友可以參考下2014-07-07jquery入門(mén)必備的基本認(rèn)識(shí)及實(shí)例(整理)
本文整理了一些jquery入門(mén)必備的基本知識(shí)及相關(guān)實(shí)例,適合初學(xué)者學(xué)習(xí),另附一些jquery的常用事件,感興趣的各位可不要錯(cuò)過(guò)了哈2013-06-06jQuery實(shí)現(xiàn)手勢(shì)解鎖密碼特效
這篇文章主要為大家詳細(xì)介紹了jQuery實(shí)現(xiàn)手勢(shì)解鎖密碼特效,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-08-08jquery實(shí)現(xiàn)漫天雪花飛舞的圣誕祝福雪花效果代碼分享
這篇文章主要介紹了jquery實(shí)現(xiàn)漫天雪花飛舞的圣誕祝福雪花效果,很浪漫,感興趣的小伙伴們可以參考一下2015-08-08jQuery EasyUI API 中文文檔 - Dialog對(duì)話(huà)框
jQuery EasyUI API 中文文檔 - Dialog對(duì)話(huà)框使用說(shuō)明,需要的朋友可以參考下。2011-11-11JQueryEasyUI之DataGrid數(shù)據(jù)顯示
在有的項(xiàng)目中,為了方便將數(shù)據(jù)庫(kù)中的某些定值儲(chǔ)存為指定的數(shù)字,怎么處理這種問(wèn)題呢?下面小編通過(guò)一段代碼給大家介紹下,需要的朋友參考下2016-11-11