document.getElementById('myElement');
document.querySelector('#myElement');

document.getElementsByClassName('myElement');
document.querySelectorAll('.myElement');

document.getElementsByTagName('div');
document.querySelectorAll('div');

document.querySelectorAll('[data-foo-bar="someval"]')

document.querySelectorAll('#myForm :invalid');

document.getElementById('myParent').children;

document.querySelector('#myParent > [ng-click]');
document.querySelectorAll('#myParent A');
document.querySelectorAll('DIV:not(.ignore)');
document.querySelectorAll('DIV, A, SCRIPT');

CSS3:
p:not(.first) {
color: red;
}
p:not(.first):not(.fourth) {
color: red;
}
元素重1开始,没有0;
p:not(:nth-child(2)):not(:first-child) {
color: red;
}

 posted on 2016-04-10 06:57  jayruan  阅读(129)  评论(0编辑  收藏  举报