{"id":50036,"date":"2020-08-22T03:01:52","date_gmt":"2020-08-21T17:01:52","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=50036"},"modified":"2020-08-21T18:32:07","modified_gmt":"2020-08-21T08:32:07","slug":"input-colour-picker-multiple-linear-gradient-background-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/input-colour-picker-multiple-linear-gradient-background-primer-tutorial\/","title":{"rendered":"Input Colour Picker Multiple Linear Gradient Background Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/input_col_multiple.htm\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=Input Colour Picker Multiple Linear Gradient Background Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/input_col_multiple.jpg\" title=\"Input Colour Picker Multiple Linear Gradient Background Primer Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Input Colour Picker Multiple Linear Gradient Background Primer Tutorial<\/p><\/div>\n<p>We&#8217;ve got two ideas floating around today&#8217;s proof of concept &#8220;Input Colour Picker Multiple Linear Gradient Background&#8221; web application concept, the second being the &#8220;proof of concept&#8221; bit, at least for us &#8230;<\/p>\n<ul>\n<li>dynamically created linear-gradient backgrounds (as you can read about recently at <a target=_blank href='https:\/\/www.rjmprogramming.com.au\/ITblog\/css-gradient-creations-popup-integration-tutorial' title='CSS Gradient Creations Popup Integration Tutorial'>CSS Gradient Creations Popup Integration Tutorial<\/a>) &#8230; augmented by the interactive input required, via the new idea of &#8230;<\/li>\n<li>input type=color &#8220;multiple&#8221; attribute (not of meaning to default HTML and CSS and Javascript that involves element types that are not &#8220;select&#8221; (dropdowns), but) made to mean something (for input type=color elements) today<\/li>\n<\/ul>\n<p> &#8230; in our inhouse HTML and Javascript <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/input_col_multiple.html-GETME\" title=\"input_col_multiple.htm\">input_col_multiple.htm<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/input_col_multiple.htm\" title=\"Click picture\">live run<\/a> link (that includes the crucial external Javascript <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/input_col_multiple.js_GETME\" title=\"input_col_multiple.js\">input_col_multiple.js<\/a> and <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/input_col_multiple.html-GETME\" title=\"input_col_multiple.htm\">derived via<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/input_col_multiple.html\" title=\"Click picture\">less interesting live run<\/a>), (any\/all of which) you can try for yourself.<\/p>\n<p>Notice some <font color=red>genericization considerations<\/font> in the Javascript with code snippets like &#8230;<\/p>\n<p><code><br \/>\n    var el=<font color=red>document.<a target=_blank title='HTML DOM querySelector() Method information from w3schools' href='https:\/\/www.w3schools.com\/jsref\/met_document_queryselector.asp'>querySelector<\/a>(\"input[type='color']\")<\/font>;  \/\/ gets first CSS'y element selector filtering (in Javascript)<br \/>\n    var eloh='';<br \/>\n    if (el && iomultiple != '') { if (el.outerHTML.toLowerCase().indexOf(' multiple') == -1) { el.setAttribute('multiple',true);  }  eloh=el.outerHTML; }<br \/>\n    if (eloh.toLowerCase().indexOf(' multiple') != -1) {<br \/>\n      \/\/ do stuff regarding document.body linear gradient background<br \/>\n    }<br \/>\n<\/code><\/p>\n<p> &#8230; or the body onload substitute code &#8230;<\/p>\n<p><code><br \/>\n  var iomultiple='';<br \/>\n<br \/>\n  function sel(oid) {<br \/>\n    if (document.getElementById(oid)) {<br \/>\n      iomultiple='' + document.getElementById(oid).value;<br \/>\n    }<br \/>\n  }<br \/>\n<br \/>\n  function onl() {<br \/>\n    var elsel=document.querySelector(\"select\");<br \/>\n    if (elsel) { <font color=blue>if (('' + elsel.id) == '') { iomultiple='' + elsel.value;  } else {<\/font> sel(('' + elsel.id)); } }<br \/>\n  }<br \/>\n<br \/> <br \/>\n  setTimeout(onl, 1000);<br \/>\n<\/code><\/p>\n<p> &#8230; where the determining &#8220;select&#8221; dropdown (as to whether linear gradients will be dynamically applied to document.body background)<strike style=color:blue> needs an ID but we do not care what that ID<\/strike> is.<\/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='#d50036' onclick='var dv=document.getElementById(\"d50036\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/multiple\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d50036' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve got two ideas floating around today&#8217;s proof of concept &#8220;Input Colour Picker Multiple Linear Gradient Background&#8221; web application concept, the second being the &#8220;proof of concept&#8221; bit, at least for us &#8230; dynamically created linear-gradient backgrounds (as you can &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/input-colour-picker-multiple-linear-gradient-background-primer-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,37],"tags":[126,224,228,281,1683,409,1839,576,609,652,2020,2092,997,2835,1319],"class_list":["post-50036","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-background","tag-colour","tag-colour-picker","tag-css","tag-dynamic","tag-external-javascript","tag-genericization","tag-html","tag-input","tag-javascript","tag-linear-gradient","tag-multiple","tag-programming","tag-queryselector","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/50036"}],"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=50036"}],"version-history":[{"count":9,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/50036\/revisions"}],"predecessor-version":[{"id":50045,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/50036\/revisions\/50045"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=50036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=50036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=50036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}