<a href="http://www.baidu.com" id="wrap" class="afei" afei="13">a标签</a>
var oWrap = document.getElementById("wrap");
//操作元素的标签属性
//获取
oWrap.href
//修改
oWrap.href = "http://xxx.com";
oWrap.className = ""; //不能用class 用 className代替
//style是一个样式的集合对象,直接赋予它字符串值,不太合适,有更好的操作
//自定义属性不能直接操作,直接操作改变不了标签里的自定义属性
//oWrap.attributes[1].nodeValue = "12";
/*
三个方法操作标签属性(包括自定义标签属性和合法标签属性)
getAttribute() 获取
setAttribute() 设置
removeAttribute() 移除
*/
console.log( oWrap.getAttribute("afei") );
oWrap.getAttribute("afei", "123"); //把afei属性的值设置为123
oWrap.removeAttribute("class") //移除class属性