以标签名和内容得到的DOM

      代码
function hasClass(name,type) {
var r = [];
// Locate the class name (allows for multiple class names)
var re = new RegExp("(^|\\s)" + name + "(\\s|$)");
// Limit search by type, or look through all elements
var e = document.getElementsByTagName(type || "*");
for ( var j = 0; j < e.length; j++ )
// If the element has the class, add it for return
if ( re.test(e[j]) ) r.push( e[j] );
// Return the list of matched elements
return r;
}

走向地狱的途中,不小心走了程序员这条路,路上一个个黑心的老板,和暗无天日的加班,我才发现,通往地狱的路径中,我们这行是最短的。

原文地址:https://www.cnblogs.com/zlfucku/p/1672672.html