<!Doctype html公开“ - // W3C // DTD XHTML 1.0 strict // en”“” http://www.org/tr/tr/xhtml1/dtd/xhtml1/xhtml1-strict.dtddddd"> <html xmlns xmlns = xml:lang ='en'> <head> <meta http-equiv ='content-type'content ='text/html; charset = utf-8'/> <meta http-equiv ='content-language'content ='en-us'/> <title>复选框选择</title> <script> <script>'text/javascript'src ='jquery-3.0.0.0.0.0.js'> > $(document).ready(function(){/**** ---------------- **** /// $('#check1')。on('change',function',function(){// $(“#check1”)。bind(“ click”,“ click”,function(“ function(” //方法一if(this.checked == true){$('input')。prop('checked',true);} else {$('input')。prop('checked',secked',false);} if($(do do do'do'do'do'do'do'do'do')。text(do'do')。 } else {$(“。do”)。text(“全选”);} //方法二//jer('input [type = checkbox]').prop( /**** -----第一列---- ****/$('#checkl1')。on('click',function(){//方法一if(this.checked == true){$('#check11,#check21,#check21,#check31,#check31,#chec k41,#check51')。prop('checked',true);} else {$('#check11,#check21,#check31,#check41,#check51')。prop('checked',false);} //方法二如上});/**** -----第二列---- ****/$('#checkl2')。on('click'',function',function(){// if(this.checked == true){$('#check12,#check12,#check22,#check22,#check22,#check32,#check32,#c heck42,#check52')。prop('checked',true);} else {$('#check12,#check22,#check22,#check32,#check42,#check52')如上});/**** -----第三列---- ****/$('#checkl3')。on('click''',function(){// if(this.checked === true){$($ check13,#check13,#check23,#check23,#check23,#check33,#check33,#ceck33,#c heck43,#check53')。prop('checked',true);} else {$('#check13,#check23,#check33,#check33,#check43,#check53')如上});/**** ----第四列------- ****/$('#checkl4')。on('click'click',function',function(){// if(this.checked == true){$('#check14,#check14,#check24,#check24,#check34,#check34,#c heck44,#check54')。prop('checked',true);} else {$('#check14,#check24,#check34,#check44,#check44,#check54')。prop('checked',false',false);} //如上});/**** ----第一行------ ****/$('#checkh1')。on('click'slick',function',function(){// if(this.checked == true){$($ check11,#check11,#check12,#check12,#c heck13,#check14')。prop('checked',true);} else {$('#check11,#check12,#check13,#check13,#check14')。prop('checked',false);} //方法二如上});/**** ----第二行------ ****/$('#checkh2')。on('click'',function',function(){// if(this.checked == true){$($ check21,#check21,#check22,#check22,#c heck23,#check24')。prop('checked',true);} else {$('#check21,#check22,#check23,#check23,#check24')。prop('checked',false);} //方法二如上});/**** ----第三行-------- ****/$('#checkh3')。on('click'',function',function(){// if(this.checked === true){$($ check31,#check31,#check32,#check32,#c heck33,#check34')。prop('checked',true);} else {$('#check31,#check32,#check33,#check33,#check34')。prop('checked',false);} //方法二如上});/**** -----第四行------- ****/$('#checkh4')。on('click'',function',function(){// if(this.checked == true){$('#check41,#check41,#check42,#c heck43,#check44')。prop('checked',true);} else {$('#check41,#check42,#check43,#check43,#check44')。prop('checked',false);} //方法二如上});/**** ----第五行-------- ****/$('#checkh5')。on('click''',function(){// function(this.checked === true){$($ check51,#check51,#check52,#check52,#c heck53,#check54')。prop('checked',true);} else {$('#check51,#check52,#check53,#check53,#check54')。prop('checked',false);} //方法二如上});}); </script> </head> <body> <table> <trag> <tr> <td> <input type =“ checepbox” id =“ check1”/> <label for =“ check1”> </label> </label> </td> <td> <td> <tput> <input> <input type ='ceptbox type type type type type type type type =“ icechl1 ceptl1 checkl1” <td> <input type =“复选框” for =“ checkl4”> </label> </td> </tr> <tr> <td> <input type type =“复选框” id =“ checkh1”/> <label for =“ checkh1”> </label> </label> </td> <td> <td> <td> <tput> <输入/> < /td> <td> <input type =“复选框” for =“ checkh2”> </label> </td> <td> <td> <input type =“复选框” id =“ check21”/> </> </> <td> <td> <input type type type =“ checkbox” iceckbox“ id =“ check22”/> </> </> </> </> <td> <td> “ Check24”/> </td> </tr> <tr> <td> <input type =“复选框” ID =“ Checkh3”/> <Label for =“ checkh3”> </td> </td> <td> <td> <tpt> <input type type =“ checkbox” /> < /td> <td> <input type =“复选框” ID =“ check33” /> < /> < /td> <td> <input type =“ checkbox” iceckbox“ id =” id =“ check34” /> < /> < /> < /> < /tr> <tr> <tr> <tr> <tt> <input type type type type type type type type =“ checkbox” checkbox =“ checkh4” for =“ checkh4”> </label> </td> <td> <input type =“复选框” “ Check44”/> </td> </tr> <tr> <td> <input type =“复选框” ID =“ checkh5”/> <Label for =“ checkh5”> </tdd> </td> <td> <td> <input> <input type type type =“ checkbox” iceckbox =“ check51” /></td><td><input type="checkbox" id = "check53" /></td><td><input type="checkbox" id = "check54" /></td></tr></tbody></table></body></html>效果图
以上所述是小编给大家介绍的复选框选中一个另一个复选框也会选中的实现代码的全部叙述,希望对大家有所帮助,如果大家想了解更多内容敬请关注武林网!,如果大家想了解更多内容敬请关注武林网!