getElementByID,getElementsByName,getElementsByTagName
2024-08-30 12:21:41
<input type="checkbox" name="hobby" id="hobby1"> 音乐
<input type="checkbox" name="hobby" id="hobby2"> 登山
<input type="checkbox" name="hobby" id="hobby3"> 游泳
<input type="checkbox" name="hobby" id="hobby4"> 阅读
<input type="checkbox" name="hobby" id="hobby5"> 打球
<input type="checkbox" name="hobby" id="hobby6"> 跑步
<input type="button" value = "全选" id="button1">
<input type="button" value = "全不选" id="button1">
1. document.getElementsByTagName("input"),结果为获取所有标签为input的元素,共8个。
2. document.getElementsByName("hobby"),结果为获取属性name="hobby"的元素,共6个。
3. document.getElementById("hobby6"),结果为获取属性id="hobby6"的元素,只有一个,"跑步"这个复选项。
最新文章
- windows下编译chromium浏览器的15个流程整理
- UITextView实现placeHolder方法汇总
- Getshell Via phpmyadmin SQL Execution In /import.php To Write Evil Webshell File Into Disk
- cookie的设置、获取以及删除
- RAC,客户端连接失败ORA-12514
- java.lang.NumberFormatException: empty String 错误
- Android 启动Activity的方式
- C#的Task和Java的Future
- Python中的classmethod与staticmethod
- [HNOI2011]赛车游戏
- python 验证码识别示例(二) 复杂验证码识别
- SqlServer 行转列,列转行 以及PIVOT函数快速实现行转列,UNPIVOT实现列转行
- [Leetcode 771]宝石和石子 Jewels and Stones HashSet简单应用
- 网页打印样式CSS
- MySQL基准测试(二)--方法
- c# 创建项目时提示:未能正确加载“microsoft.data.entity.design.bootstrappackage.。。。。
- 在虚拟机上安装gho、esd(wim)系统镜像文件
- Linux U盘安装
- [UE4]给Widget增加参数,Pre Construct和Construct的区别
- GitHub出现Permissiondenied (publickey).
热门文章
- 咕咕咕,skkyk的博客生活从此开始了
- luogu3834 【模板】可持久化线段树 1(主席树)
- 爬虫开发python工具包介绍 (4)
- [工具使用] visualvm 通过jmx不能连接
- Given a binary tree, return the level order traversal of its nodes&#39; values. (ie, from left to right, level by level). For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20 / \
- ospf 提升 二 ---LSA
- 【Luogu】P2324骑士精神(IDA*)
- 【2018.10.20】noip模拟赛Day3 飞行时间
- angular中ng-repeat去重
- POJ Blue Jeans [枚举+KMP]