表单javascript checkbox全选 反选 全不选
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>javascript checkbox全选 反选 全不选</title>
<meta name="description" content="">
<meta name="keywords" content="">
<link href="" rel="stylesheet">
</head>
<body>
<form action="">
<p><input type="checkbox"></p>
<p><input type="checkbox"></p>
<p><input type="checkbox"></p>
<p><input type="checkbox"></p>
<p><input type="checkbox"></p>
<p><input type="checkbox"></p>
</br>
<input type="button" id="a_xuan" value="全选" onclick="all_xuan()">
<input type="button" id="a_n_xuan" value="反选" onclick="fan_xuan()">
<input type="button" id="f_xuan" value="全不选" onclick="all_no_xuan()"> </form> </body> <script> //全选
function all_xuan()
{
var all_xuan=document.getElementById('a_xuan');
if(all_xuan!='')
{
var input_c=document.getElementsByTagName('input');
for(var i=0;i<input_c.length;i++)
{
input_c[i].checked="true";
}
}
} //全不选
function all_no_xuan()
{
var all_xuan=document.getElementById('f_xuan');
if(all_xuan!='')
{
var input_c=document.getElementsByTagName('input');
for(var i=0;i<input_c.length;i++)
{
input_c[i].checked="";
}
}
} //反选
function fan_xuan()
{
var all_xuan=document.getElementById('a_n_xuan');
if(all_xuan!='')
{
var input_c=document.getElementsByTagName('input');
for(var i=0;i<input_c.length-1;i++)
{ if(input_c[i].checked)
{
input_c[i].checked="";
}else
{
input_c[i].checked="true";
} }
}
} </script>
</html>
表单javascript checkbox全选 反选 全不选的更多相关文章
- 【HTML5】页面点击按钮添加一行 删除一行 全选 反选 全不选
页面点击按钮添加一行 删除一行 全选 反选 全不选 页面效果图如下 html页面代码 <!DOCTYPE html> <html> <head> & ...
- 表单提交checkbox的值
问题:怎么在表单提交的时候提交多个多选框CheckBox的值? 解决方式:在CheckBox的name属性名后添加[]; 例: <input type="checkbox" ...
- 表单Checkbox全选反选全不选
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- checkbook全选/反选/全不选
<!doctype html><html lang="en"><head> <meta charset="UTF-8" ...
- vue实现单选多选反选全选全不选
单选 当我们用v-for渲染一组数据的时候,我们可以带上index以便区分他们我们这里利用这个index来简单地实现单选 <li v-for="(item,index) in radi ...
- Bootstrap 表单和图片 (内联表单,表单合组,水平排列,复选框和单选框,下拉列表,校验状态,添加额外的图标,控制尺寸,图片)
一.表单 基本格式 注:只有正确设置了输入框的 type 类型,才能被赋予正确的样式. 支持的输入框控件 包括:text.password.datetime.datetime-local.date.m ...
- 文字和表单(checkbox/radio)元素垂直对齐方法,兼容Firefox和IE。
这几天在做表单时总会碰到复选框(checkbox)和单选框(radio)与文字不对齐的问题,要不是checkbox上浮了,要不是文字上浮.在前端开发过程中,单(复)选框和它们后面的提示文字在不进行任何 ...
- 在PHP中处理表单之—Checkbox
原文翻译自:http://www.html-form-guide.com/php-form/php-form-checkbox.html 单个checkbox 形如: <form action ...
- Vue表单输入绑定(文本框和复选框)
文本框 <!DOCTYPE html><html> <head> <meta charset="utf-8"> ...
随机推荐
- MVC 校验
校验保障了MVC 应用程序安全性. Models 文件夹包含表示应用程序模型的类 1,创建一个项目MvcValidateDemo. 2,创建一个实体类UserInfo在Models中,包含Id.Use ...
- ubuntu14.04 cocos2d-x-3.6 glfw编译出错解决方案
lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::GLViewImpl()': /home ...
- qt下面例子学习(部分功能)
from aa import Ui_Formfrom PyQt4.Qt import *from PyQt4.QtCore import *from PyQt4.QtGui import *from ...
- (转)iOS7界面设计规范(13) - UI基础 - 与iOS的系统整合
突然就到了周日傍晚.你永远不会知道自己的生活在接下来的一周当中能够发生多少变化:各种不可预知性所带来的更多是快感还是焦虑与不安,冷暖自知.相比之下,白天工作当中那些需求列表与排期文档就显得那么可爱了, ...
- Cortex-A9 PWM Timer
PWM定时器 4412时钟为我们提供了PWM定时器,在4412中共有5个32位的定时器,这些定时器可发送中断信号给ARM子系统.另外,定时器0.1.2.3包含了脉冲宽度调制(PWM),并 ...
- 查看linux版本和内核信息
一.查看Linux内核版本命令(两种方法): 1.cat /proc/version [root@localhost ~]# cat /proc/versionLinux version 2.6.32 ...
- HTMl5的sessionStorage和localStorage(转)
html5中的Web Storage包括了两种存储方式:sessionStorage和localStorage. sessionStorage用于本地存储一个会话(session)中的数据,这些数据只 ...
- VMware 虚拟机使用RedHat,出现 connect: Network is unreachable解決方法
http://www.linuxidc.com/Linux/2015-02/113119.htm http://www.osyunwei.com/archives/7829.html
- C# winform 窗体 彻底退出窗体的方法
1.this.Close(); 只是关闭当前窗口,若不是主窗体的话,是无法退出程序的,另外若有托管线程(非主线程),也无法干净地退出: 2.Application.Exit(); 强制所有消 ...
- 关于jquery-easyUI中主键属性data-options的了解
data-options是jQuery Easyui 最近两个版本才加上的一个特殊属性.通过这个属性,我们可以对easyui组件的实例化可以完全写入到html中,例如: <div class=& ...