标签:支持 target 查询 elements intern 3.5 var rom .class
querySelector和querySelectorAll是W3C提供的 新的查询接口,其主要特点如下:
var obj = document.querySelector("#id");
var obj = document.querySelector(".classname");
var obj = document.querySelector("div");
var el = document.body.querySelector("style[type=‘text/css‘], style:not([type])");
var elements = document.querySelectorAll("#score>tbody>tr>td:nth-of-type(2)");
var elements = document.querySelectorAll("#id1, #id2, .class1, class2, div a, #list li img");
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 1 | 3.5 (1.9.1) bug 416317 |
9 8 (CSS2 selectors only) |
10 | 3.2 (525.3) WebKit bug 16587 |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 2.1 | yes | 9 | 10.0 | 3.2 |
document.querySelector和querySelectorAll方法
标签:支持 target 查询 elements intern 3.5 var rom .class
原文地址:http://www.cnblogs.com/zq123/p/6693829.html