Home > Web Front-end > JS Tutorial > js checkbox (checkbox) use collection_form effects

js checkbox (checkbox) use collection_form effects

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:53:35
Original
1046 people have browsed it

function selectAll() //全选
{
var objs = document.getElementsByName('twId');
var i;
for(i = 0; i {
if(objs[i].type == "checkbox")
{
objs[i].checked = true;
}
}
}
function unselect() //反选
{
var objs = document.getElementsByName('twId');
var i;
for(i=0;i{
if(objs[i].type=='checkbox')
{
if(objs[i].checked == true)
{
objs[i].checked =false;
}
else
{
objs[i].checked =true;
}
}
}
}
function idArray() //得到批量处理的twId
{
var objs = window.document.getElementsByName('twId');
var i;
var idArray = new Array();
var j = 0;
for(i=0;i{
if(objs[i].type=='checkbox')
{
if(objs[i].checked == true)
{
idArray[j] = objs[i].value;
j = j 1;
}
}
}
return idArray;
}
function evArray() //得到批量处理的city
{
var objs = window.document.getElementsByName('twId');
var evObj = window.document.getElementsByName('cityStr');
var i;
var evArray = new Array();
var j = 0;
for(i=0;i{
if(objs[i].type=='checkbox')
{
if(objs[i].checked == true)
{
evArray[j] = evObj[i].value;
j = j 1;
}
}
}
return evArray;
}
function selectUser()  //把选择到的值写到文本框
{
 var userIds = new Array();
userIds = idArray();
  var userIdString = userIds.join(",");  //数组字符串化
   document.getElementById('member').value=userIdString;
}

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Where is js written?
From 1970-01-01 08:00:00
0
0
0
js addClass not working
From 1970-01-01 08:00:00
0
0
0
js file code not found
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template