大家好,又见面了,我是你们的朋友全栈
①将type类型设为”checkbox”
②name=””用来设置变量名
③value=””用来设置变量默认值
④<input>此处设置需要显示的内容<br>
代码示例:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>html复选框</title> </head> <body> <form> <label>请选择你喜欢的水果:</label><br> <input type="checkbox" name="apple" value="苹果">苹果<br> <input type="checkbox" name="banana" value="香蕉">香蕉<br> <input type="checkbox" name="orange" value="橙子">橙子<br> <input type="checkbox" name="melon" value="西瓜">西瓜<br> <input type="submit"> </form> </body> </html>
运行截图:
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/167014.html原文链接:https://javaforall.cn