修改方法:1、使用setAttribute()方法修改節點屬性的值,語法「節點.setAttribute(屬性名稱,值)」;2、使用removeAttribute()方法刪除指定的屬性,語法「節點.removeAttribute(屬性名)」。
本教學操作環境:windows7系統、javascript1.8.5版、Dell G3電腦。
javascript修改元素節點的屬性
#setAttribute() 方法設定屬性值
##使用元素的setAttribute() 方法可以設定元素的屬性值。用法如下:setAttribute(name, value)
红盒子蓝盒子
removeAttribute() 方法刪除屬性
#使用元素的 removeAttribute() 方法可以刪除指定的屬性。用法如下:removeAttribute(name)
数据表格 |
以上是javascript怎麼修改元素節點的屬性的詳細內容。更多資訊請關注PHP中文網其他相關文章!