1.通过ID或者其他元素找到要处理的HTML对象:(举例通过ID)
var obj=document.getElementById(\'id\');
1
2.操作此对象
添加属性:obj.setAttribute(\'attr_name\',\'attr_value\');
获取属性值:obj.getAttribute(\'attr_name\');
删除属性:obj.removeAttribute(\'attr_name\');
原文:https://blog.csdn.net/living_ren/article/details/79349402