读书人

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

发布时间: 2012-06-26 10:04:14 作者: rapoo

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

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

读书人网 >Web前端

热点推荐