JS checkbox Method One:
Copy CodeThe code is as follows:
function Checkall ()
{
var code_values = document.all[' Code_value '];
if (code_values.length) {
for (Var i=0;i<code_values.length;i++)
{
Code_values[i].checked = true;
}
}else{
Code_values.checked = true;
}
}
function Uncheckall ()
{
var code_values = document.all[' Code_value '];
if (code_values.length) {
for (Var i=0;i<code_values.length;i++)
{
code_values[i].checked = false;
}
}else{
code_values.checked = false;
}
}
function Multipledelete ()
{
var num = 0;
var code_values = document.all[' Code_value '];
if (code_values.length) {
for (Var i=0;i<code_values.length;i++)
{
if (code_values[i].checked = = True)
{
num + +;
}
}
}else{
if (code_values.checked = = True) {
num + +;
}
}
if (num = = 0) {
Alert (' Please select Delete item ');
}
if (num >0) {
Document. Bucodesearch.action = ' <%=eusutil.getpage ("lookup.generic.bucode.delete.s")%> ';
Document. Bucodesearch.submit ();
}
}
</script>
JS checkbox Method Two:
Copy CodeThe code is as follows:
function Checkall ()
{
var code_values = document.getelementsbytagname ("input");
for (i = 0;i < code_values.length;i++) {
if (Code_values[i].type = = "checkbox")
{
Code_values[i].checked = true;
}
}
}
function Uncheckall ()
{
var code_values = document.getelementsbytagname ("input");
for (i = 0;i < code_values.length;i++) {
if (Code_values[i].type = = "checkbox")
{
code_values[i].checked = false;
}
}
}
function Multipledelete ()
{
if (document. bucodesearch.elements["Code_value"])
{
var num = 0;
var fm = document. Bucodesearch;
if (document. bucodesearch.elements["Code_value"])
{
var elm = document. bucodesearch.elements["Code_value"];
var ename = "Code_value";
if (elm.length) {
var len = fm.elements[ename].length;
for (var i = 0; i< len; i++) {
var e = fm.elements[ename][i];
if (e.checked = = True) {
num++;
}
}
} else {
if (elm.checked = = True) {
num++;
}
}
if (num > 0)
{
Document. Bucodesearch.action = ' <%=eusutil.getpage ("lookup.generic.bucode.delete.s")%> ';
Document. Bucodesearch.submit ();
}
}
}
}
Code_value is the name of the checkbox form and Bucodesearch is the form name
Copy CodeThe code is as follows:
<TD align= "left" width= "><input type=" checkbox "Name=" Code_value "value=" <%= Userdeffieldvaluebean.getudfvalue ()%> "></td>
Compare full JS checkbox Select All, deselect all, delete function code