1.通过ID或者其他元素找到要处理的HTML对象:(举例通过ID)
var obj=document.getElementById('id');
2.操作此对象
添加属性:obj.setAttribute('attr_name','attr_value');
获取属性值:obj.getAttribute('attr_name');
删除属性:obj.removeAttribute('attr_name');
原文链接:https://blog.csdn.net/living_ren/article/details/79349402
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。
还没有人抢沙发呢~