5.2 document DOM 扩展

优质
小牛编辑
135浏览
2023-12-01
MethodKindArgumentsDescription
getElementsByClassName(className [, parentElement])instanceclassName: name of a CSS class associated with the elements, parentElement: object or id of the element that contains the elements being retrieved.返回所有CSS className属性等于className参数的元素,如果没有给出parentElement,那么将搜索document body。(此处使用document.body我觉得不如使用document,因为有时有的页面没有body)