{"id":246,"date":"2010-08-21T09:51:09","date_gmt":"2010-08-21T09:51:09","guid":{"rendered":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/?p=246"},"modified":"2010-08-21T09:51:09","modified_gmt":"2010-08-21T09:51:09","slug":"jak-zaskrtnout-skupinu-checkboxu","status":"publish","type":"post","link":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/jak-zaskrtnout-skupinu-checkboxu\/","title":{"rendered":"Jak za\u0161krtnout skupinu checkboxu?"},"content":{"rendered":"<div class=\"958545b2ffe6a18f89c3ac8a7be9162a\" data-index=\"3\" style=\"float: none; margin:0px;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-9849429965459928\";\r\n\/* Blog 300x250 \u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bdl\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00a1nky *\/\r\ngoogle_ad_slot = \"0479547637\";\r\ngoogle_ad_width = 300;\r\ngoogle_ad_height = 250;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p><font size=\"3\">Na webu je spousta n&aacute;vod\u016f jak za&scaron;krtnout v&scaron;echny checkboxy ve formul&aacute;\u0159i, ale pokud chcete za&scaron;krtnout pouze n\u011bjakou skupinku, je&scaron;t\u011b k tomu ka\u017edou jinak pojmenovanou a je&scaron;t\u011b k tomu kdy\u017e je jich poka\u017ed&yacute; jin&eacute; mno\u017estv&iacute;, je to tro&scaron;ku o\u0159&iacute;&scaron;ek. Na&scaron;t\u011bst&iacute; \u0159e&scaron;en&iacute; existuje. Zdrojem je <a href=\"http:\/\/www.codingforums.com\/archive\/index.php\/t-68342.html\" target=\"_blank\">diskuse na codingforums.com<\/a> a \u0159e&scaron;en&iacute; je n&iacute;\u017ee:<\/font><\/p>\n<p><font size=\"3\"><\/font><\/p>\n<p>&lt;script type=&quot;text\/javascript&quot;&gt;<br \/>function checkAll(checkbox, theCommonNodeName) {<br \/>theCommonNodeName = theCommonNodeName.toLowerCase();<br \/>var theCommonNode = checkbox.parentNode;<br \/>while(theCommonNode.nodeName.toLowerCase() != theCommonNodeName &amp;&amp; theCommonNode != document) {<br \/>theCommonNode = theCommonNode.parentNode;<br \/>}<\/p>\n<p>if(theCommonNode.nodeName.toLowerCase() != theCommonNodeName) {<br \/>alert(&quot;Common parent node could not be found&quot;);<br \/>return;<br \/>}<\/p>\n<p>var inputs = theCommonNode.getElementsByTagName(&quot;input&quot;);<br \/>for(var i=0; inputs[i]; i++) {<br \/>if(inputs[i].type == &quot;checkbox&quot;) {<br \/>inputs[i].checked = checkbox.checked;<br \/>}<br \/>}<br \/>}<br \/>&lt;\/script&gt;<br \/>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<br \/>&lt;h1&gt;Test 1&lt;\/h1&gt;<br \/>&lt;form name=&quot;frmTest1&quot;&gt;<br \/>Check all in this form:&lt;input type=&quot;checkbox&quot; name=&quot;chkAll&quot; onclick=&quot;checkAll(this, &#8216;form&#8217;);&quot;&gt;<br \/>&lt;br&gt;&lt;br&gt;<br \/>checkbox1:&lt;input type=&quot;checkbox&quot; name=&quot;chk1&quot;&gt;&lt;br&gt;<br \/>checkbox2:&lt;input type=&quot;checkbox&quot; name=&quot;chk2&quot;&gt;&lt;br&gt;<br \/>checkbox3:&lt;input type=&quot;checkbox&quot; name=&quot;chk3&quot;&gt;&lt;br&gt;<br \/>&lt;\/form&gt;<br \/>&lt;hr&gt;<\/p><!--CusAds0-->\n<p>&lt;h1&gt;Test 2&lt;\/h1&gt;<br \/>&lt;form name=&quot;frmTest2&quot;&gt;<br \/>&lt;table border=&quot;1&quot; cellspacing=&quot;1&quot; cellpadding=&quot;2&quot;&gt;<br \/>&lt;tr&gt;&lt;td&gt;Check all in this table:&lt;input type=&quot;checkbox&quot; name=&quot;chkAll&quot; onclick=&quot;checkAll(this, &#8216;table&#8217;);&quot;&gt;&lt;\/td&gt;&lt;\/tr&gt;<br \/>&lt;tr&gt;&lt;td&gt;checkbox1:&lt;input type=&quot;checkbox&quot; name=&quot;chk1&quot;&gt;&lt;\/td&gt;&lt;\/tr&gt;<br \/>&lt;tr&gt;&lt;td&gt;checkbox2:&lt;input type=&quot;checkbox&quot; name=&quot;chk2&quot;&gt;&lt;\/td&gt;&lt;\/tr&gt;<br \/>&lt;tr&gt;&lt;td&gt;checkbox3:&lt;input type=&quot;checkbox&quot; name=&quot;chk3&quot;&gt;&lt;\/td&gt;&lt;\/tr&gt;<br \/>&lt;\/table&gt;<br \/>&lt;\/form&gt;<br \/>&lt;hr&gt;<\/p>\n<p>&lt;h1&gt;Test 3&lt;\/h1&gt;<br \/>&lt;form name=&quot;frmTest3&quot;&gt;<br \/>&lt;table border=&quot;1&quot; cellspacing=&quot;1&quot; cellpadding=&quot;2&quot;&gt;<br \/>&lt;tr&gt;<br \/>&lt;td&gt;Check all in this row:&lt;input type=&quot;checkbox&quot; name=&quot;chkAll&quot; onclick=&quot;checkAll(this, &#8216;tr&#8217;);&quot;&gt;&lt;\/td&gt;<br \/>&lt;td&gt;checkbox1:&lt;input type=&quot;checkbox&quot; name=&quot;chk1&quot;&gt;&lt;\/td&gt;<br \/>&lt;td&gt;checkbox2:&lt;input type=&quot;checkbox&quot; name=&quot;chk2&quot;&gt;&lt;\/td&gt;<br \/>&lt;td&gt;checkbox3:&lt;input type=&quot;checkbox&quot; name=&quot;chk3&quot;&gt;&lt;\/td&gt;<br \/>&lt;\/tr&gt;<br \/>&lt;tr&gt;<br \/>&lt;td&gt;Check all in this row:&lt;input type=&quot;checkbox&quot; name=&quot;chkAll&quot; onclick=&quot;checkAll(this, &#8216;tr&#8217;);&quot;&gt;&lt;\/td&gt;<br \/>&lt;td&gt;checkbox4:&lt;input type=&quot;checkbox&quot; name=&quot;chk4&quot;&gt;&lt;\/td&gt;<br \/>&lt;td&gt;checkbox5:&lt;input type=&quot;checkbox&quot; name=&quot;chk5&quot;&gt;&lt;\/td&gt;<br \/>&lt;td&gt;checkbox6:&lt;input type=&quot;checkbox&quot; name=&quot;chk6&quot;&gt;&lt;\/td&gt;<br \/>&lt;\/tr&gt;<br \/>&lt;\/table&gt;<br \/>&lt;\/form&gt;<br \/>&lt;\/body&gt;<br \/>&lt;\/html&gt;<br \/>The code should be pretty self-explanatory, the onclick you add to your &quot;check all&quot; checkbox should be:onclick=&quot;checkAll(this, &#8216;the common parent html tag for your checkboxes&#8217;);&quot;<br \/>eg:<br \/>onclick=&quot;checkAll(this, &#8216;tr&#8217;);&quot;<br \/>or:<br \/>onclick=&quot;checkAll(this, &#8216;div&#8217;);&quot;<br \/>or:<br \/>onclick=&quot;checkAll(this, &#8216;table&#8217;);&quot;<br \/>etc etc<\/p>\n<div class=\"958545b2ffe6a18f89c3ac8a7be9162a\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"pub-9849429965459928\";\r\n\/* Blog 234x60 texty, vytvo\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00c2\u00af\u00c3\ufffd\u00c2\u00bf\u00c3\ufffd\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\u00af\u00c2\u00bf\u00c2\u00bd\u00c3\ufffd\u00ef\u00bf\u00bd\u00c3\ufffd\u00c2\u00bdeno 10.1.11 *\/\r\ngoogle_ad_slot = \"1054435175\";\r\ngoogle_ad_width = 234;\r\ngoogle_ad_height = 60;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Na webu je spousta n&aacute;vod\u016f jak za&scaron;krtnout v&scaron;echny checkboxy ve formul&aacute;\u0159i, ale pokud chcete za&scaron;krtnout pouze n\u011bjakou skupinku, je&scaron;t\u011b k tomu ka\u017edou jinak pojmenovanou a je&scaron;t\u011b k tomu kdy\u017e je jich poka\u017ed&yacute; jin&eacute; mno\u017estv&iacute;, je to tro&scaron;ku o\u0159&iacute;&scaron;ek. Na&scaron;t\u011bst&iacute; \u0159e&scaron;en&iacute; existuje. Zdrojem je diskuse na codingforums.com a \u0159e&scaron;en&iacute; je n&iacute;\u017ee: &lt;script type=&quot;text\/javascript&quot;&gt;function checkAll(checkbox, theCommonNodeName) {theCommonNodeName &hellip; <a href=\"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/jak-zaskrtnout-skupinu-checkboxu\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Jak za\u0161krtnout skupinu checkboxu?<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[19,16],"class_list":["post-246","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-html","tag-javascript"],"_links":{"self":[{"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/posts\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/comments?post=246"}],"version-history":[{"count":1,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/posts\/246\/revisions"}],"predecessor-version":[{"id":247,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/posts\/246\/revisions\/247"}],"wp:attachment":[{"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/media?parent=246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/categories?post=246"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/6378.wms78.wedos.ws\/subdom\/blog\/wp-json\/wp\/v2\/tags?post=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}