This is a common effect in many websites. You can click the check box for the total category and select the check boxes for all subcategories automatically, or if all the check boxes of the subcategory are selected, the total category check box is also automatically selected.
This time I accidentally saw it on the msn website, so I tried to write it myself.
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ptml xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "en" lang = "en"> <pead> <title> </title> <script type = "text/javascript"> function checkAll (str) {var a = document. getElementById ("t" + str ). getElementsByTagName ("input"); var B = document. getElementById ("d" + str); for (var I = 0; I </pead> <body> <center> <input type = "checkbox" id = "d1" onclick = "checkAll ('1 ') "/> leisure and entertainment <input type =" checkbox "onclick =" fixChk ('1 ') "/> books and magazines <input type =" checkbox "onclick =" fixChk ('1 ') "/> music and album <input type =" checkbox "onclick =" fixChk ('1') "/> travel </center> </body> </ptml>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]