JavaScript: 如何获取HTML元素对应JavaScript对象
一、概述:
在JavaScript中可以使用四种函数来获取HTML元素对应的JavaScript对象:
1.getElementById(“”):获取id为某值的HTML元素对应JavaScript对象。
2.getElementsByClassName(""):获取class为某值的HTML元素对应JavaScript对象数组。
3.getElementsByName(""):获取name为某值的HTML元素对应JavaScript对象数组。
4.getElementsByTagName("")
原创
2020-07-17 16:22:16 ·
287 阅读 ·
0 评论