博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2011年3月6日

摘要: 获取一个节点的属性很简单, elem[ attrName ] 似乎就好,稍复杂点的还可以是 elem.getAttribute( attrName );既然这么简单,似乎就没必要介绍了。但万恶的浏览器们让这么简单的东西变得很复杂。本文讲的属性包括以下这么函数:setAttributegetAttributehasAttributesetStylegetStyle1. getAttribute getAttr 主要解决特殊属性的兼容, 比如 href src 等属性,在 IE 必须使用 getAttrbute('src', 2) 才能获取真实内容。2. setAttribute 阅读全文

posted @ 2011-03-06 00:14 xuld 阅读(1294) 评论(1) 推荐(0) 编辑