{"id":26499,"date":"2021-04-26T23:10:07","date_gmt":"2021-04-27T03:10:07","guid":{"rendered":"http:\/\/bangla.salearningschool.com\/recent-posts\/javascript-code-programming-code-examples-javascript-javascript\/"},"modified":"2021-04-26T23:10:07","modified_gmt":"2021-04-27T03:10:07","slug":"javascript-code-programming-code-examples-javascript-javascript","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=26499","title":{"rendered":"JavaScript Code #Programming Code Examples #Javascript #JavaScript"},"content":{"rendered":"<pre style='font-size:12px;padding:10px'>\n                var browser=navigator.appName;\n                var b_version=navigator.appVersion;\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\n\n\n&lt;a href=&quot;http:\/\/www.justetc.net&quot; target=&quot;_blank&quot;&gt;\n&lt;img border=&quot;0&quot; alt=&quot;hello&quot; src=&quot;b_pink.gif&quot; id=&quot;b1&quot; width=&quot;26&quot; height=&quot;26&quot; onmouseover=&quot;mouseOver()&quot; onmouseout=&quot;mouseOut()&quot; \/&gt;\n\n<br \/>\nPlace the following code under script tag\/in a javascript file\n\nfunction mouseOver()\n{\n   document.getElementById(&quot;b1&quot;).src =&quot;b_blue.gif&quot;;\n}\n\nfunction mouseOut()\n{\n   document.getElementById(&quot;b1&quot;).src =&quot;b_pink.gif&quot;;\n}\n\n\n\n\n\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\n\n&lt;map name=&quot;planetmap&quot;&gt;\n\n&lt;area shape =&quot;rect&quot; coords =&quot;0,0,82,126&quot;\nonMouseOver=&quot;writeText('You are over the target area')&quot;\nhref =&quot;target.htm&quot; target =&quot;_blank&quot; alt=&quot;target&quot; \/&gt;\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\nvar t1=setTimeout(&quot;document.getElementById('id1').value='2 seconds!'&quot;,2000);\nvar t2=setTimeout(&quot;document.getElementById('id1').value='4 seconds!'&quot;,4000);\nvar t3=setTimeout(&quot;document.getElementById('id1').value='6 seconds!'&quot;,6000);\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\nDirect Instance: \n\npObj=new Object();\npObj.firstname=&quot;John&quot;;\npObj.lastname=&quot;Doe&quot;;\npObj.age=50;\npObj.eyecolor=&quot;blue&quot;;\n\ndocument.write(pObj.firstname + &quot; is &quot; + pObj.age + &quot; years \n\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\nfunction car(brand,make,model)\n{\nthis.brand=brand;\nthis.make=make;\nthis.model=model;\n}\nvar myCar=new car(&quot;Honda&quot;,&quot;2009&quot;,&quot;Accord&quot;);\ndocument.write(myCar.brand +  myCar.make + myCar.model );\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\ntry\n{\n}\ncatch(err)\n{\n}\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\n\nUnder script tag\/javascript file:\n\nonerror=handleErr;\nvar alertTxt = &quot;&quot; \n\nfunction handleErr(msg, url, l)\n{\n   alertTxt = &quot;Error Information:.nn&quot;;\n   alertTxt += msg + &quot;n&quot;;\n   alertTxt += url + &quot;n&quot;;\n   alertTxt += l + &quot;nn&quot;;\n   alertTxt += &quot;Click OK to continue.nn&quot;;\n   alert(alertTxt);\n   return true;\n}\n\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\n\nvar x;\nvar myFriends= new Array();\nmyFriends[0] = &quot;Shafiq&quot;;\nmyFriends[1] = &quot;Rafiq&quot;;\nmyFriends[2] = &quot;Abba&quot;;\nmyFriends[3] = &quot;Amma&quot;;\n\nfor (x in myFriends)\n{\n   document.write(myFriends[x] + &quot;<br \/>&quot;);\n}\n\n\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\nvar d = new Date();\ntheDay=d.getDay();\nswitch (theDay)\n{\ncase 5:\n  document.write(&quot;<b>Friday<\/b>&quot;);\n  break;\ncase 6:\n  document.write(&quot;<b>Saturday<\/b>&quot;);\n  break;\ncase 0:\n  document.write(&quot;<b>Sunday<\/b>&quot;);\n  break;\n}\n<\/pre>\n<pre style='font-size:12px;padding:10px'>\n   var pattern = new RegExp(&quot;e&quot;,&quot;g&quot;);\n   do\n   {\n     result=pattern .exec(&quot;This is the line where the regular expression will be searched on&quot;);\n     document.write(result);\n   }\n   while (result!=null) \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=10182<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>var browser=navigator.appName; var b_version=navigator.appVersion; &lt;a href=&quot;http:\/\/www.justetc.net&quot; target=&quot;_blank&quot;&gt; &lt;img border=&quot;0&quot; alt=&quot;hello&quot; src=&quot;b_pink.gif&quot; id=&quot;b1&quot; width=&quot;26&quot; height=&quot;26&quot; onmouseover=&quot;mouseOver()&quot; onmouseout=&quot;mouseOut()&quot; \/&gt; Place the following code under script tag\/in a javascript file function mouseOver() { document.getElementById(&quot;b1&quot;).src =&quot;b_blue.gif&quot;; } function mouseOut() { document.getElementById(&quot;b1&quot;).src =&quot;b_pink.gif&quot;; } &lt;map name=&quot;planetmap&quot;&gt; &lt;area shape =&quot;rect&quot; coords =&quot;0,0,82,126&quot; onMouseOver=&quot;writeText(&#8216;You are over the target area&#8217;)&quot; href =&quot;target.htm&quot; target &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/bangla.sitestree.com\/?p=26499\">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_memberships_contains_paid_content":false,"footnotes":""},"categories":[1917],"tags":[],"class_list":["post-26499","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":10564,"url":"http:\/\/bangla.sitestree.com\/?p=10564","url_meta":{"origin":26499,"position":0},"title":"JavaScript Code","author":"","date":"August 29, 2015","format":false,"excerpt":"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var browser=navigator.appName; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 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() { \u00a0\u00a0 document.getElementById(\"b1\").src =\"b_blue.gif\"; } function mouseOut() { \u00a0\u00a0 document.getElementById(\"b1\").src =\"b_pink.gif\"; } <map name=\"planetmap\"> <area shape =\"rect\" coords =\"0,0,82,126\"\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":10548,"url":"http:\/\/bangla.sitestree.com\/?p=10548","url_meta":{"origin":26499,"position":1},"title":"Javascript : Miscellaneous Code","author":"","date":"August 29, 2015","format":false,"excerpt":"\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 var browser=navigator.appName; \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 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() { \u00a0\u00a0 document.getElementById(\"b1\").src =\"b_blue.gif\"; } function mouseOut() { \u00a0\u00a0 document.getElementById(\"b1\").src =\"b_pink.gif\"; } <map name=\"planetmap\"> <area shape =\"rect\" coords =\"0,0,82,126\"\u2026","rel":"","context":"In &quot;Ajax&quot;","block_context":{"text":"Ajax","link":"http:\/\/bangla.sitestree.com\/?cat=1418"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27156,"url":"http:\/\/bangla.sitestree.com\/?p=27156","url_meta":{"origin":26499,"position":2},"title":"Javascript : Miscellaneous Code #Programming Code Examples #Java\/J2EE\/J2ME #Ajax","author":"Author-Check- Article-or-Video","date":"May 12, 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":70149,"url":"http:\/\/bangla.sitestree.com\/?p=70149","url_meta":{"origin":26499,"position":3},"title":"JavaScript Miscellaneous Topics #13","author":"Author-Check- Article-or-Video","date":"August 27, 2021","format":false,"excerpt":"JavaScript Miscellaneous Topics. Please check below. Detect browser name and version: var browser=navigator.appName; var b_version=navigator.appVersion; Other browser related: navigator.appCodeName, navigator.platform, navigator.platform , navigator.cookieEnabled , navigator.userAgent, navigator.appMinorVersion, navigator.cpuClass, navigator.onLine, navigator.browserLanguage, navigator.systemLanguage, navigator.userLanguage It's a good idea to use escape function for setting cookie values (if more than one word). Also, use\u2026","rel":"","context":"In &quot;FromSitesTree.com&quot;","block_context":{"text":"FromSitesTree.com","link":"http:\/\/bangla.sitestree.com\/?cat=1917"},"img":{"alt_text":"hello","src":"b_pink.gif","width":350,"height":200},"classes":[]},{"id":70147,"url":"http:\/\/bangla.sitestree.com\/?p=70147","url_meta":{"origin":26499,"position":4},"title":"Random Notes on JavaScript\/HTML #13","author":"Author-Check- Article-or-Video","date":"August 27, 2021","format":false,"excerpt":"This short-note will make sense, only if you already have some javascript sense. It can be used - just to refresh memory, once in a while. My JavaScript Experience? started on 2000, conducted a JavaScript Training Session on 2001, wrote a book for a training institute on JavaScript on 2001,\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":70135,"url":"http:\/\/bangla.sitestree.com\/?p=70135","url_meta":{"origin":26499,"position":5},"title":"JavaScript &#8211; Miscellaneous Validations #13","author":"Author-Check- Article-or-Video","date":"August 27, 2021","format":false,"excerpt":"function validateDomainName(strValue) { return \/www.[a-z0-9_-]+.[a-z]{2, 3}\/ig.test(strValue); } function validateDomainName(strValue) { return \/www.[a-z0-9_-]+.[a-z]{2, 3}\/ig.test(strValue); } \/\/not 100% right, will fix later function checkDateFormat() { var pattern = new RegExp(0|1[0-9]\/[0-3][0-9]\/[0-9][0-9]); if(document.getElementById('timestampStarted').value.match(pattern)) { var date_array = document.getElementById('timestampStarted').value.split('\/'); var month = date_array[0]; var day = date_array[1]; var year = date_array[2]; \/\/ This instruction will\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\/26499","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=26499"}],"version-history":[{"count":0,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/26499\/revisions"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=26499"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=26499"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=26499"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}