添加,设置:
(1). div.setAttribute("ok","ok?");
html:
(2). var ok = document.createAttribute("name");
div.setAttributeNode(ok);
html:
获取:
(1).div.getAttribute("ok");//ok?
(2)var v = div.getAttributeNode("ok").value;// div.getAttributeNode("ok")获取的是//AttributeNode对象。
删除
(1).document.getElementById("id").removeAttribute("ok");//ok为属性名。
(2).document.getElementById("id").removeAttributeNode(ok);//ok为AttributeNode对象。
很重要的一个方法
document.getElementsByTagName
Copyright © 2019- smpy.cn 版权所有
违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务