标签:
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");
目前IE8+,ff,chrome都支持此api
document.querySelector和querySelectorAll方法
标签:
原文地址:http://www.cnblogs.com/ghlucky/p/5727385.html