查询元素是不是含有指定的属性

查询元素是否含有指定的属性api的应用场景是:查询元素是否含有指定的属性。?关于ZYC.dom.g的资料:http://zh

查询元素是否含有指定的属性

api的应用场景是:查询元素是否含有指定的属性。

?

关于ZYC.dom.g的资料:http://zhangyaochun.iteye.com/blog/1439262

?

?

?

?

/**hasAttr --- check the element if it has the name attribute**@function**@param {HTMLElement} element**@param {String} name the name that looked for**@return {Boolean}**/ZYC.dom.hasAttr = function(element,name){    element = ZYC.dom.g(element);var attr = element.attributes.getNamedItem(name);return !!(attr && attr.specified);};