zoukankan
html css js c++ java
[原] 页面checkbox “全选定” 和 “全取消” 操作的实现(JavaScript)
Web开发时,页面上常常需要对checkbox实现全选定 和 全取消的操作。
页面的HTML代码
<
input
type
='checkbox'
name
='info'
value
='a'
>
<
input
type
='checkbox'
name
='info'
value
='b'
>
<
input
type
='checkbox'
name
='info'
value
='c'
>
<
input
type
='checkbox'
name
='info'
value
='d'
>
<
input
type
='checkbox'
name
='info'
value
='e'
>
<
br
/>
<
input
type
='button'
value
='
全选定 'onclick
='check_all();'
>
<
input
type
='button'
value
='
全取消 'onclick
='check_all_un();'
>
对应的JavaScript代码
<
script
>
function
check_all()
{
//
全选定
arr
=
document.getElementsByName('info');
for
(i
=
0
;i
<
arr.length;i
++
)
{
arr[i].checked
=
true
;
}
}
function
check_all_un()
{
//
全取消
arr
=
document.getElementsByName('info');
for
(i
=
0
;i
<
arr.length;i
++
)
{
arr[i].checked
=
false
;
}
}
</
script
>
查看全文
相关阅读:
nrm安装与配置(nrm管理npm源)
Mac启动MongoDB报错:exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
基本类型(例如:int)数组和ArrayList之间的转化
sqlite3--sqlite3_prepare
fgets
strdup
openssl-EVP_md5()
FIPS--Federal Information Processing Standards
pthread_mutexattr_gettype、pthread_mutexattr_settype、pthread_mutexattr_destroy、pthread_mutexattr_init!
gethostname&&getdomainname
原文地址:https://www.cnblogs.com/temptation/p/791746.html
最新文章
地质年代的小知识
刚接触SkyLine的一点小收获与感触
cgi,fastcig,php-fpm
mysql给一个库建立管理员
layer 提示框
mysql 查询当前运行的事务
TP6中间件别名
PHP7 declare(strict_types=1)
tp6 中间件
单例模式
热门文章
tp6 使用模板引擎
tp6自定义异常
git rm -r --cached解决已提交的文件在.gitignore中加入忽略后无效的问题。
axios中qs的使用
axios中get请求的params参数中带数组的处理方法
MD5加密常用js库:crypto-js
To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
git报错:fatal: No configured push destination.
Mac解决:xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Copyright © 2011-2022 走看看