{"id":70517,"date":"2025-11-11T03:01:00","date_gmt":"2025-11-10T17:01:00","guid":{"rendered":"https:\/\/www.rjmprogramming.com.au\/ITblog\/?p=70517"},"modified":"2025-11-10T16:11:48","modified_gmt":"2025-11-10T06:11:48","slug":"drag-and-drop-peers-external-javascript-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/drag-and-drop-peers-external-javascript-tutorial\/","title":{"rendered":"Drag and Drop Peers External Javascript Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Drag and Drop Peers External Javascript Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop_ej.gif\" title=\"Drag and Drop Peers External Javascript Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Drag and Drop Peers External Javascript Tutorial<\/p><\/div>\n<p>There would have to be lots of provisos, but wouldn&#8217;t it be good regarding yesterday&#8217;s <a title='Drag and Drop Peers Primer Tutorial' href='#ddppt'>Drag and Drop Peers Primer Tutorial<\/a>&#8216;s <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php\" rel=\"noopener\">Drag and Drop supervisor<\/a> web application, for mobile, if &#8230;<\/p>\n<blockquote><p>\nSome form of external Javascript tool could help out and improve on the dropdown with size attribute greater than one not showing option elements up front regarding their rendered display\n<\/p><\/blockquote>\n<p>?  We think so.  To our mind, the provisos are &#8230;<\/p>\n<ul>\n<li>prove that the size attribute greater than one rendering not being honoured by the web browser (which have always been regarding mobile platforms, in our experience) &#8230; we can do this via <a target=\"_blank\" title='getBoundingClientRect' href='https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/Element\/getBoundingClientRect' rel=\"noopener\">getBoundingClientRect<\/a> check of rendered dropdown element height &#8230;<\/li>\n<li>prove that dropdown <i>multiple<\/i> attribute not present &#8230;<\/li>\n<li>map a clear dropdown <i>onchange<\/i> event logic to a new <i>onclick<\/i> one, possible, we think, if &#8230;\n<ol>\n<li>down from the dropdown &#8230; via &lt;br&gt; &#8230;<\/li>\n<li>with the dropdown width (and getBoundingClientRect height) &#8230; we add &#8230;<\/li>\n<li>button elements whose <i>value<\/i> attribute, if not nothing, matches that of a corresponding dropdown <i>option<\/i> subelement &#8230; and &#8230;<\/li>\n<li>button element <i>innerHTML<\/i> matches that of a corresponding dropdown <i>option<\/i> subelement<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p>We applied all these checks into some proof of concept <a target=\"_blank\" title='selectbuttons.js' href='http:\/\/www.rjmprogramming.com.au\/selectbuttons.js_GETME' rel=\"noopener\">selectbuttons.js<\/a> external Javascript logic &#8230;<\/p>\n<p><code><br \/>\n\/\/ selectbuttons.js<br \/>\n\/\/ RJM Programming<br \/>\n\/\/ November, 2025<br \/>\n\/\/ Where apt help out select size=>1 not multiple not with code complexity scenarios with buttons, especially for mobile platforms<br \/>\n\/\/ Thanks to https:\/\/www.google.com\/search?q=can+button+element+still+get+given+a+value+attribute&rlz=1C5OZZY_en&oq=can+button+element+still+get+given+a+value+attribute&gs_lcrp=EgZjaHJvbWUyBggAEEUYOTIHCAEQIRigATIHCAIQIRiPAtIBCTE0MDM0ajBqNKgCALACAQ&sourceid=chrome&ie=UTF-8#cobssid=s<br \/>\n<br \/>\n function selbutcheck() {<br \/>\n   var thispartoh='', izs=1, rectsis=null, bheight=0, bwidth=0, oncis='', optswillbe=[], iow=0, bihfrom='', bihto='';<br \/>\n   var selsarr=document.getElementsByTagName('select');<br \/>\n   for (var iselr=0; iselr&lt;selsarr.length; iselr++) {<br \/>\n     thispartoh=selsarr[iselr].outerHTML.split('&gt;')[0];<br \/>\n     if (thispartoh.indexOf(' multiple') == -1) {<br \/>\n      if (thispartoh.indexOf(' size=\"') != -1 || thispartoh.indexOf(\" size='\") != -1) {<br \/>\n        izs=eval(thispartoh.split(' size=')[1].substring(1).split(thispartoh.split(' size=')[1].substring(0,1))[0]);<br \/>\n        if (izs &gt; 1) {<br \/>\n          rectsis=selsarr[iselr].getBoundingClientRect();<br \/>\n          bheight=Math.floor(eval('' + rectsis.height) \/ eval('' + eval('' + selsarr[iselr].size)))<br \/>\n          bwidth=eval('' + rectsis.width);<br \/>\n          if (navigator.userAgent.match(\/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile\/i)) {<br \/>\n            if (eval('' + rectsis.height) &lt; 33) {<br \/>\n               bheight=eval('' + rectsis.height);<br \/>\n               if (thispartoh.indexOf(' onchange=\"') != -1 || thispartoh.indexOf(\" onchange='\") != -1) {<br \/>\n                 oncis=' onclick=' + thispartoh.split(' onchange=')[1].substring(0,1) + thispartoh.split(' onchange=')[1].substring(1).split(thispartoh.split(' onchange=')[1].substring(0,1))[0] + thispartoh.split(' onchange=')[1].substring(0,1) + ' ';<br \/>\n                 optswillbe=selsarr[iselr].innerHTML.split(selsarr[iselr].innerHTML.split('&lt;\/option&gt;')[0] + '&lt;\/option&gt;')[1].split('&lt;\/option&gt;');<br \/>\n                 bihfrom=selsarr[iselr].outerHTML;<br \/>\n                 bihto=selsarr[iselr].outerHTML;<br \/>\n                 for (iow=0; iow&lt;optswillbe.length; iow++) {<br \/>\n                   if (optswillbe[iow].trim() != '') {<br \/>\n                     bihto+='&lt;br&gt;&lt;button style=\"width:' + bwidth + 'px;height:' + bheight + 'px;\" ' + oncis + ' value=\"' + optswillbe[iow].split(' value=\"')[1].split('\"')[0] + '\"&gt;' + optswillbe[iow].split('&gt;')[1] + '&lt;\/button&gt;';<br \/>\n                   }<br \/>\n                 }<br \/>\n                 if (bihto != bihfrom) {<br \/>\n                   document.body.innerHTML=document.body.innerHTML.replace(bihfrom, bihto);<br \/>\n                 }<br \/>\n               }<br \/>\n            }<br \/>\n          }<br \/>\n        }<br \/>\n      }<br \/>\n     }<br \/>\n   }<br \/>\n }<br \/>\n<br \/>\n setTimeout(selbutcheck, 5000);<br \/>\n<\/code><\/p>\n<p> &#8230; to <a target=\"_blank\" title='experimental_peers_drag_and_drop.php' href='http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php-GETME' rel=\"noopener\">a changed<\/a> <a target=\"_blank\" title='experimental_peers_drag_and_drop.php' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php-GETME' rel=\"noopener\">experimental_peers_drag_and_drop.php<\/a> PHP <a target=\"_blank\" title='experimental_peers_drag_and_drop.php' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php' rel=\"noopener\">Drag and Drop supervisor<\/a> web application you can also <a href='#ifmy'>try below<\/a>, and we were happy with the result applied to yesterday&#8217;s starting logic.  We even left the dropdown in for mobile platforms, and it was our view that made it &#8220;sort of&#8221; become better than non-mobile for how we perceived our user experience to be.  Either dropdown or buttons could achieve their aim on mobile platforms.<\/p>\n<p><!--p>You can also see this play out at WordPress 4.1.1's <a target=\"_blank\" href='\/\/www.rjmprogramming.com.au\/ITblog\/drag-and-drop-peers-external-javascript-tutorial\/' rel=\"noopener\">Drag and Drop Peers External Javascript Tutorial<\/a>.<\/p-->\n<hr>\n<p id='ddppt'>Previous relevant <a target=\"_blank\" title='Drag and Drop Peers Primer Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/drag-and-drop-peers-primer-tutorial\/' rel=\"noopener\">Drag and Drop Peers Primer Tutorial<\/a> is shown below.<\/p>\n<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php\" rel=\"noopener\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Drag and Drop Peers Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.gif\" title=\"Drag and Drop Peers Primer Tutorial\"  style=\"float:left;\"  \/><\/a><p class=\"wp-caption-text\">Drag and Drop Peers Primer Tutorial<\/p><\/div>\n<p>We&#8217;ve decided to gather the Drag and Drop games into a &#8220;peerage&#8221; of web applications so that one central supervisory web application can point the user into the correct direction to find them, or one of them, as per the PHP <a target=\"_blank\" title='PHP glob method information' href='http:\/\/php.net\/manual\/en\/function.glob.php' rel=\"noopener\">glob<\/a> and &#8220;clone&#8221; based &#8230;<\/p>\n<p><code><br \/>\n&lt;?php<br \/>\n\/\/ experimental_peers_drag_and_drop.php<br \/>\n\/\/ RJM Programming<br \/>\n\/\/ November, 2025<br \/>\n\/\/ Make peers of all the experimental drag and drop logic based web applications<br \/>\n<br \/>\n $sofar=\"\";<br \/>\n $listis='';<br \/>\n foreach (glob(dirname(__FILE__) . DIRECTORY_SEPARATOR . '*.php') as $filename) {<br \/>\n   $contis=file_get_contents($filename);<br \/>\n   if (strpos($contis, \"templa\" . \"tegame=file_get_contents('.\/experimental_drag_and_drop.htm\") !== false) {<br \/>\n     if (strpos($filename, \"_new_\") === false && strpos($sofar, str_replace('_','',str_replace($_SERVER['DOCUMENT_ROOT'], '', $filename))) === false) {<br \/>\n     if ($listis == '') {<br \/>\n       $listis.=str_replace($_SERVER['DOCUMENT_ROOT'], '', $filename);<br \/>\n     } else {<br \/>\n       $listis.=',' . str_replace($_SERVER['DOCUMENT_ROOT'], '', $filename);<br \/>\n     }<br \/>\n     $sofar.=str_replace('_','',str_replace($_SERVER['DOCUMENT_ROOT'], '', $filename));<br \/>\n     }<br \/>\n   }<br \/>\n }<br \/>\n $larris=explode(',', $listis);<br \/>\n $htmlis='&lt;html&gt;&lt;head&gt;&lt;title&gt;Experimental Drag and Drop Peers - RJM Programming - November, 2025&lt;\/title&gt;&lt;\/head&gt;&lt;body&gt;&lt;h1&gt;Experimental Drag and Drop Peers&lt;\/h1&gt;&lt;h3&gt;RJM Programming - November, 2025&lt;\/h3&gt;&lt;select onchange=\"if (this.value.length != 0) { window.open(this.value,' . \"'_blank','top=120,left=510,width=940,height=660'\" . '); }\" id=mysel size=' . (3 + sizeof($larris)) . '&gt;&lt;option value=\"\"&gt;Optionally select an Experimental Drag and Drop web application, to try, below ...&lt;\/option&gt;&lt;option value=\"\/HTMLCSS\/chess_game.php\"&gt;Chess game&lt;\/option&gt;&lt;option value=\"\/HTMLCSS\/gradual_reveal_country_game.htm\"&gt;Reveal country game&lt;\/option&gt;&lt;\/select&gt;&lt;\/body&gt;&lt;\/html&gt;';<br \/>\n <br \/>\n if ($listis != '') {<br \/>\n    for ($i=0; $i&lt;sizeof($larris); $i++) {<br \/>\n      $htmlis=str_replace('&lt;\/select&gt;', '&lt;option value=\"' . $larris[$i] . '\"&gt;' . strtoupper(substr(str_replace('_',' ',explode('.', basename($larris[$i]))[0]),0,1)) . substr(str_replace('_',' ',explode('.', basename($larris[$i]))[0]),1) . \"&lt;\/option&gt;&lt;\/select&gt;\", $htmlis);<br \/>\n    }<br \/>\n    echo $htmlis;<br \/>\n }<br \/>\n <br \/>\n?&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; as a <a target=\"_blank\" title='experimental_peers_drag_and_drop.php' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php_GETME' rel=\"noopener\">proof of concept<\/a> <a target=\"_blank\" title='experimental_peers_drag_and_drop.php' href='http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php' rel=\"noopener\">Drag and Drop supervisor<\/a> web application you can also try below &#8230;<\/p>\n<p><iframe id=ifmy style=\"width:100%;height:900px;\" src='\/\/www.rjmprogramming.com.au\/HTMLCSS\/experimental_peers_drag_and_drop.php'><\/iframe><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d70511' onclick='var dv=document.getElementById(\"d70511\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/glob\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d70511' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n<hr>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d70517' onclick='var dv=document.getElementById(\"d70517\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/external-javascript\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d70517' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>There would have to be lots of provisos, but wouldn&#8217;t it be good regarding yesterday&#8217;s Drag and Drop Peers Primer Tutorial&#8216;s Drag and Drop supervisor web application, for mobile, if &#8230; Some form of external Javascript tool could help out &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/drag-and-drop-peers-external-javascript-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/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":[12,14,29,37],"tags":[112,174,2503,2509,354,2237,364,4385,367,409,418,1615,1525,652,770,795,1631,861,3440,5319,5318,932,997,1035,1866,2056,1222,2005,1319,1360,5317],"class_list":["post-70517","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-operating-system","category-tutorials","tag-attribute","tag-button","tag-clone","tag-cloning","tag-dom","tag-drag","tag-drag-and-drop","tag-drop","tag-dropdown","tag-external-javascript","tag-file","tag-glob","tag-innerhtml","tag-javascript","tag-menu","tag-mobile","tag-onchange","tag-onclick","tag-peer","tag-peerage","tag-peers","tag-php","tag-programming","tag-redirect","tag-select","tag-suite","tag-supervisor","tag-tool","tag-tutorial","tag-value","tag-web-applications"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/70517"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=70517"}],"version-history":[{"count":10,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/70517\/revisions"}],"predecessor-version":[{"id":70527,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/70517\/revisions\/70527"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=70517"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=70517"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=70517"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}