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;
}

相关文章:

  • 2021-12-27
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
相关资源
相似解决方案