html之checkbox------checkbox只是input框的type属性
2016-02-26 23:59
561 查看
<html> <body> 我喜欢自行车:<input type="checkbox" id="Bike"> <br /> 我喜欢汽车:<input type="checkbox" id="Car"> <br /> <button onClick="output()">test</button> <script> function output() { if(document.getElementById("Bike").checked) { alert("1"); } if(document.getElementById("Car").checked) { alert("2"); } } </script> </body> </html>
是否选中, 直接看selected这个属性。
另外注意, 在html中, checkbox并不是一个单独的标签, 而是input框的type属性, 这和我之前玩过的BCB/VC++不一致。
相关文章推荐
- html开发随笔二
- html开发随笔一
- html下拉框之间的联动------一级分类和二级分类
- HTML day02(html列表与菜单的制作)
- html模块一些方法
- Html 链接、图像、表格、表单、背景
- HTML 5 Web 存储——localStorage
- HTML 5 Web 存储——localStorage
- 让html文件也具体include包含的功能
- [置顶] html中隐藏域hidden的作用介绍及使用示例
- php语言,如何用html代码输出一个网页ob_start&&ob_end_flush
- HTML Button.onclick 事件汇总
- 纯HTML页面为了避免频繁前后台Ajax交互方案
- HTML下拉框多选
- HTML day01基础总结
- Intellij IDEA 插件的安装(live edit为例,实现HTML自动换行缩进/保存/刷新等功能)
- Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement'
- C#学习之HTML
- html meta中的viewport指令
- HTML select option基础理解及使用