支持系统属性与默认属性的
取值
示例:获取a标签对象的href属性的值
var href = a.getAttribute("href")
赋值
示例:给a标签对象的href属性赋值
a.setAttribute("href", "https://zhidao.baidu.com/")
删除
示例:删除a标签对象的title属性
a.removeAttribute("title")
微信扫一扫
支持系统属性与默认属性的
示例:获取a标签对象的href属性的值
var href = a.getAttribute("href")
示例:给a标签对象的href属性赋值
a.setAttribute("href", "https://zhidao.baidu.com/")
示例:删除a标签对象的title属性
a.removeAttribute("title")
相关推荐