摘要:document.getElementById(id); 通過ID獲取元素,不常用document.getElementsByName('login')通過Name屬性獲取元素document.getElementsByTagName('li')通過標簽名獲取元素document.body標簽名快捷方式獲取document.images['pic']
document.getElementById(id); 通過ID獲取元素,不常用
document.getElementsByName('login')通過Name屬性獲取元素
document.getElementsByTagName('li')通過標簽名獲取元素
document.body標簽名快捷方式獲取
document.images['pic']Name屬性快捷方式獲取
document.getElementsByClassName('ul')Class屬性獲取
document.querySelector('#ul').querySelectorAll('.green')通過CSS選擇器獲取元素
之前課程中最常見到最后兩種方式
批改老師:滅絕師太批改時間:2018-11-23 15:53:07
老師總結:總結的不錯,但是要運用到實例中去奧,結合案例最好!