标签:
//ELEMENT DOM选择
//on are tag names. //All the divs on the page: $$(‘div‘); //All the divs and paragraphs //note: this returns an array with all the divs first, //then all the paragraphs: $$(‘div‘, ‘p‘); //When you include Selectors.js, you can //pass in CSS selectors. //All the divs with the css class ‘myClass‘: $$(‘div.myClass‘) /All the paragraphs that are inside divs: $$(‘div p‘); //All the bold tags in paragraphs with //Class ‘foo‘ in divs with class ‘myClass‘: $$(‘div.myClass p.foo b‘);
可以继承Selectors的DOM方法 | |
Element.getElement | Element.getAllNext |
Element.getElements | Element.getFirst |
Element.match | Element.getLast |
Element.getPrevious | Element.getParent |
Element.getAllPrevious | Element.getParents |
Element.getNext | Element.getChildren |
//All the inputs where name equals ‘email‘ $$(‘input[name=email]‘) //All the images with urls that end in .gif: $$(‘img[src$=gif]‘) //All the links without target="_blank": $$(‘a[target!=_blank]‘) Note that these expressions can take double or single quotes when you want to search for something that has a space or other character: $$(‘input[name!="user[username]"]‘) $$(‘img[src$=".gif"]‘)
CSS3表达式匹配规则 | |
= | 匹配给定的属性是某个特定值的元素 |
^= | 匹配给定的属性是以某些值开始的元素 |
$= | 匹配给定的属性是以某些值结尾的元素 |
!= | 匹配给定的属性是不包含某个特定值的元素 |
*= | 匹配给定的属性是以包含某些值的元素 |
~= |
该属性的值必须是一系列用空格隔开的多个值,(比如,class=”title featured home”),而且这些值中的一个必须是指定的值”value”。 |
|= |
属性的值就是“value”或者以“value”开始并立即跟上一个“-”字符,也就是“value-”。(比如lang=”zh-cn”) [javascript]MooTools Selectors(MooTools 选择器) ELEMENT DOM选择 标签: 原文地址:http://www.cnblogs.com/GaoAnLee/p/5092600.html
踩
(0)
赞
(0)
举报
评论 一句话评论(0)
分享档案
|