{"id":26495,"date":"2021-04-26T23:10:07","date_gmt":"2021-04-27T03:10:07","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/getelementsbyname-an-example-checkbox-programming-code-examples-javascript-javascript\/"},"modified":"2021-04-26T23:10:07","modified_gmt":"2021-04-27T03:10:07","slug":"getelementsbyname-an-example-checkbox-programming-code-examples-javascript-javascript","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=26495","title":{"rendered":"GetElementsByName an example: Checkbox #Programming Code Examples #Javascript #JavaScript"},"content":{"rendered":"<pre>\n&lt;html&gt;\n\n\t&lt;head&gt;\n\t\t&lt;script type=&quot;text\/javascript&quot;&gt;\n\t\t\tfunction getElements()\n\t\t\t  {\n\t\t\t  var x=document.getElementsByName(&quot;myInput[]&quot;);\n\t\t\t  alert(x.length);\n\t\t\t  alert(x[0].value);\n\t\t\t  alert(x[1].value);\n\t\t\t  alert(x[2].value);\n\n\n\t\t\t  }\n\t\t&lt;\/script&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n\t&lt;input name=&quot;myInput[]&quot; type=&quot;checkbox&quot; size=&quot;20&quot; value='10'\/&gt;10 <br \/>\n\n\t&lt;input name=&quot;myInput[]&quot; type=&quot;checkbox&quot; size=&quot;20&quot; value='20' \/&gt;20<br \/>\n\t&lt;input name=&quot;myInput[]&quot; type=&quot;checkbox&quot; size=&quot;20&quot; value='30' \/&gt;30<br \/>\n\t&lt;br \/&gt;\n\t&lt;input type=&quot;button&quot; onclick=&quot;getElements()&quot; value=&quot;How many elements named &#039;myInput&#039;?&quot; \/&gt;\n&lt;\/body&gt;\n\n&lt;\/html&gt;\n\n<\/pre>\n<p>Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on Jan 2nd, 2017 From: http:\/\/sitestree.com\/?p=10179<br \/> Categories:Programming Code Examples, Javascript, JavaScript<br \/>Tags:JavascriptJavaScript<br \/> Post Data:2017-01-02 16:04:23<\/p>\n<p>\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com\/' target='new' rel=\"noopener\">https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\t(Big Data, Cloud, Security, Machine Learning): Courses: <a href='http:\/\/Training.SitesTree.com' target='new' rel=\"noopener\"> http:\/\/Training.SitesTree.com<\/a><br \/>\n\t\tIn Bengali: <a href='http:\/\/Bangla.SaLearningSchool.com' target='new' rel=\"noopener\">http:\/\/Bangla.SaLearningSchool.com<\/a><br \/>\n\t\t<a href='http:\/\/SitesTree.com' target='new' rel=\"noopener\">http:\/\/SitesTree.com<\/a><br \/>\n\t\t8112223 Canada Inc.\/JustEtc: <a href='http:\/\/JustEtc.net' target='new' rel=\"noopener\">http:\/\/JustEtc.net (Software\/Web\/Mobile\/Big-Data\/Machine Learning) <\/a><br \/>\n\t\tShop Online: <a href='https:\/\/www.ShopForSoul.com'> https:\/\/www.ShopForSoul.com\/<\/a><br \/>\n\t\tMedium: <a href='https:\/\/medium.com\/@SayedAhmedCanada' target='new' rel=\"noopener\"> https:\/\/medium.com\/@SayedAhmedCanada <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&lt;html&gt; &lt;head&gt; &lt;script type=&quot;text\/javascript&quot;&gt; function getElements() { var x=document.getElementsByName(&quot;myInput[]&quot;); alert(x.length); alert(x[0].value); alert(x[1].value); alert(x[2].value); } &lt;\/script&gt; &lt;\/head&gt; &lt;body&gt; &lt;input name=&quot;myInput[]&quot; type=&quot;checkbox&quot; size=&quot;20&quot; value=&#8217;10&#8217;\/&gt;10 &lt;input name=&quot;myInput[]&quot; type=&quot;checkbox&quot; size=&quot;20&quot; value=&#8217;20&#8217; \/&gt;20 &lt;input name=&quot;myInput[]&quot; type=&quot;checkbox&quot; size=&quot;20&quot; value=&#8217;30&#8217; \/&gt;30 &lt;br \/&gt; &lt;input type=&quot;button&quot; onclick=&quot;getElements()&quot; value=&quot;How many elements named &#039;myInput&#039;?&quot; \/&gt; &lt;\/body&gt; &lt;\/html&gt; Note: Brought from our old site: http:\/\/www.salearningschool.com\/example_codes\/ on &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=26495\">Continue reading<\/a><\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1917],"tags":[],"class_list":["post-26495","post","type-post","status-publish","format-standard","hentry","category-fromsitestree-com","item-wrap"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":10562,"url":"http:\/\/bangla.sitestree.com\/?p=10562","url_meta":{"origin":26495,"position":0},"title":"GetElementsByName an example: Checkbox","author":"","date":"August 29, 2015","format":false,"excerpt":"<html> \u00a0\u00a0 \u00a0<head> \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0<script type=\"text\/javascript\"> \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0function getElements() \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 { \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 var x=document.getElementsByName(\"myInput[]\"); \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 alert(x.length); \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 alert(x[0].value); \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 alert(x[1].value); \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 alert(x[2].value); \u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0 } \u00a0\u00a0 \u00a0\u00a0\u00a0\u2026","rel":"","context":"In &quot;Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8&quot;","block_context":{"text":"Code . Programming Samples . \u09aa\u09cd\u09b0\u09cb\u0997\u09cd\u09b0\u09be\u09ae \u0989\u09a6\u09be\u09b9\u09b0\u09a8","link":"http:\/\/bangla.sitestree.com\/?cat=1417"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65788,"url":"http:\/\/bangla.sitestree.com\/?p=65788","url_meta":{"origin":26495,"position":1},"title":"Handling Checkbox arrays with Javascript::GetElementsByName:XHTML supported #JavaScript","author":"Author-Check- Article-or-Video","date":"July 14, 2021","format":false,"excerpt":"The following code demonstrates how to handle checkboxes with JavaScript. Note the names of all c heck boxes are same myInput[]. It could also be myInput. Both works as an array to contain the controls' values. I prefer myInput[] as you can handle this control in PHP as an array.\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":70125,"url":"http:\/\/bangla.sitestree.com\/?p=70125","url_meta":{"origin":26495,"position":2},"title":"Handling Checkbox arrays with Javascript::GetElementsByName:XHTML supported #13","author":"Author-Check- Article-or-Video","date":"August 26, 2021","format":false,"excerpt":"The following code demonstrates how to handle checkboxes with javascript. Note the names of all check boxes are same myInput[]. It could also be myInput. Both works as an array to contain the controls' values. I prefer myInput[] as you can handle this control in PHP as an array. If\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6299,"url":"http:\/\/bangla.sitestree.com\/?p=6299","url_meta":{"origin":26495,"position":3},"title":"\u09ac\u09c1\u099f\u09b8\u09cd\u099f\u09cd\u09b0\u09cd\u09af\u09be\u09aa \u09ab\u09b0\u09ae \u0987\u09a8\u09aa\u09c1\u099f (Bootstrap Form Inputs)","author":"Author-Check- Article-or-Video","date":"February 13, 2015","format":false,"excerpt":"\u09ae\u09cb: \u0986\u09b8\u09be\u09a6\u09c1\u099c\u09cd\u099c\u09be\u09ae\u09be\u09a8 \u09ae\u09bf\u09b2\u09a8 \u0986\u0987\u099f\u09bf \u0987\u09a8\u09cd\u09b8\u099f\u09cd\u09b0\u09be\u0995\u09cd\u099f\u09b0, \u098f\u09ae\u098f\u09b8\u0986\u0987\u099f\u09bf, \u0995\u09c1\u09dc\u09bf\u0997\u09cd\u09b0\u09be\u09ae\u0964 \u00a0 \u09b8\u09ae\u09b0\u09cd\u09a5\u09bf\u09a4 \u09ab\u09b0\u09ae \u0995\u09a8\u09cd\u099f\u09cd\u09b0\u09cb\u09b2 \u09ac\u09c1\u099f\u09b8\u09cd\u099f\u09cd\u09b0\u09cd\u09af\u09be\u09aa \u09a8\u09bf\u09ae\u09cd\u09a8\u09b2\u09bf\u0996\u09bf\u09a4 \u09ab\u09b0\u09cd\u09ae \u0995\u09a8\u09cd\u099f\u09cd\u09b0\u09cb\u09b2\u0997\u09c1\u09b2\u09cb \u09b8\u09ae\u09b0\u09cd\u09a5\u09a8 \u0995\u09b0\u09c7 input textarea checkbox radio select \u00a0 \u09ac\u09c1\u099f\u09b8\u09cd\u099f\u09cd\u09b0\u09cd\u09af\u09be\u09aa \u0987\u09a8\u09aa\u09c1\u099f \u09ac\u09c1\u099f\u09b8\u09cd\u099f\u09cd\u09b0\u09cd\u09af\u09be\u09aa \u098f\u0987\u099a\u099f\u09bf\u098f\u09ae\u098f\u09b2 \u09eb \u098f\u09b0 \u09b8\u0995\u09b2 \u0987\u09a8\u09aa\u09c1\u099f \u099f\u09be\u0987\u09aa, \u09af\u09c7\u09ae\u09a8 : text, password, time, color. datetime, datetime-local, date, month, week, number, email, url \u0987\u09a4\u09cd\u09af\u09be\u09a6\u09bf \u09b8\u09b0\u09cd\u09ae\u09a5\u09a8 \u0995\u09b0\u09c7\u0964 \u09a8\u09bf\u099a\u09c7\u09b0\u2026","rel":"","context":"In &quot;\u09ac\u09c1\u099f\u09b8\u09cd\u099f\u09cd\u09b0\u09cd\u09af\u09be\u09aa \u09e9 \u099f\u09bf\u0989\u099f\u09cb\u09b0\u09bf\u09df\u09be\u09b2 (Bootstrap 3 Tutorial)&quot;","block_context":{"text":"\u09ac\u09c1\u099f\u09b8\u09cd\u099f\u09cd\u09b0\u09cd\u09af\u09be\u09aa \u09e9 \u099f\u09bf\u0989\u099f\u09cb\u09b0\u09bf\u09df\u09be\u09b2 (Bootstrap 3 Tutorial)","link":"http:\/\/bangla.sitestree.com\/?cat=178"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26499,"url":"http:\/\/bangla.sitestree.com\/?p=26499","url_meta":{"origin":26495,"position":4},"title":"JavaScript Code #Programming Code Examples #Javascript #JavaScript","author":"Author-Check- Article-or-Video","date":"April 26, 2021","format":false,"excerpt":"var browser=navigator.appName; var b_version=navigator.appVersion; <a href=\"http:\/\/www.justetc.net\" target=\"_blank\"> <img border=\"0\" alt=\"hello\" src=\"b_pink.gif\" id=\"b1\" width=\"26\" height=\"26\" onmouseover=\"mouseOver()\" onmouseout=\"mouseOut()\" \/> Place the following code under script tag\/in a javascript file function mouseOver() { document.getElementById(\"b1\").src =\"b_blue.gif\"; } function mouseOut() { document.getElementById(\"b1\").src =\"b_pink.gif\"; } <map name=\"planetmap\"> <area shape =\"rect\" coords =\"0,0,82,126\" onMouseOver=\"writeText('You are over the\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":65784,"url":"http:\/\/bangla.sitestree.com\/?p=65784","url_meta":{"origin":26495,"position":5},"title":"Some JavaScript stuff that you need to know #JavaScript","author":"Author-Check- Article-or-Video","date":"July 14, 2021","format":false,"excerpt":"What you really need to learn in Javascript? 1. Where you can place JavaScript codes? Anywhere in the web-pages, ideally in the header section, or in an external file. If you keep javascript codes in an external file, the codes will be re-usable from different web-pages 2. Some basic programming:\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26495","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=26495"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26495\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26495"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}