{"id":56080,"date":"2022-06-11T03:01:32","date_gmt":"2022-06-10T17:01:32","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=56080"},"modified":"2022-06-10T18:57:56","modified_gmt":"2022-06-10T08:57:56","slug":"daylight-saving-time-select-option-title-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/daylight-saving-time-select-option-title-tutorial\/","title":{"rendered":"Daylight Saving Time Select Option Title Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/HTMLCSS\/daylight_saving_time.html\"><img decoding=\"async\" style=\"border: 15px solid pink;\" alt=\"Daylight Saving Time Select Option Title Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/daylight_saving_time_title.jpg\" title=\"Daylight Saving Time Select Option Title Tutorial\"  style=\"float:left;\" \/><\/a><p class=\"wp-caption-text\">Daylight Saving Time Select Option Title Tutorial<\/p><\/div>\n<p>We&#8217;ve many a time dreamed up web applications that would fill an HTML select element&#8217;s option tag innerHTMLs with image data.  But no, the select element has, like the Javascript popup windows, a lot of underlying operating system workings making it more difficult to CSS style<font size=1>, much<\/font>.<\/p>\n<p>Before now, we&#8217;ve realized that emojis are not out of bounds here, and they can display like images <font size=1>, a bit<\/font>.<\/p>\n<p>And today, with  <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/PHP\/Geographicals\/diff.php?one=http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/daylight_saving_time.html----------------GETME\" title=\"daylight_saving_time.html\">our changed<\/a> <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/daylight_saving_time.html----------------GETME\" title=\"daylight_saving_time.html\">daylight_saving_time.html<\/a>&#8216;s <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/daylight_saving_time.html\">web application<\/a> <font size=1>(you can read more about at <a target=_blank title='Safari Web Inspector Network Tab Headers PHP Post Tutorial' href='\/\/www.rjmprogramming.com.au\/ITblog\/safari-web-inspector-network-tab-headers-php-post-tutorial\/'>Safari Web Inspector Network Tab Headers PHP Post Tutorial<\/a>)<\/font> we embellish some emoji flags in a select element&#8217;s option innerHTML with <font size=1>(best seen on non-mobile)<\/font> on hover title attribute associated Country names.<\/p>\n<p>Yes, it was not always the case, but these days the select element&#8217;s option tag can support (and display) a <font color=blue>title attribute<\/font>, with regarding the HTML &#8230;<\/p>\n<p><code><br \/>\n&lt;select style='width:220px;' onchange='fixit(this.value);' id='timezone' name='timezone'&gt;&lt;option id='otz' value=''&gt;Please select a timezone below ...&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='-18: ' id='o-18'<\/font> value='-18'&gt;-18&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='-17: ' id='o-17'<\/font> value='-17'&gt;-17&lt;\/option&gt;<br \/>\n...<br \/>\n&lt;\/select&gt;<br \/>\n&lt;select style='display:inline-block;width:240px;' onfocus=\" document.getElementById('dfrom').innerHTML=''; document.getElementById('dto').innerHTML='';  \" onchange=\" populatesel(document.getElementById('lookif'));\" id='region' name='region'&gt;&lt;option value=''&gt;Optionally, please select a region below ...&lt;\/option&gt;<br \/>\n&lt;option <font color=blue>title='Africa: ' id=oafrica <\/font>value='Africa'&gt;Africa&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='America: ' id=oamerica<\/font> value='America'&gt;America&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='Antarctica: ' id=oantarctica<\/font> value='Antarctica'&gt;Antarctica&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='Arctic: ' id=oarctic<\/font> value='Arctic'&gt;Arctic&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='Asia: ' id=oasia<\/font> value='Asia'&gt;Asia&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='Atlantic: ' id=oatlantic<\/font> value='Atlantic'&gt;Atlantic&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='Australia: ' id=oaustralia<\/font> value='Australia'&gt;Australia&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='Europe: ' id=oeurope<\/font> value='Europe'&gt;Europe&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='Indian: ' id=oindian<\/font> value='Indian'&gt;Indian&lt;\/option&gt;<br \/>\n&lt;option<font color=blue> title='Pacific: ' id=opacific<\/font> value='Pacific'&gt;Pacific&lt;\/option&gt;<br \/>\n&lt;\/select&gt;<br \/>\n<\/code><\/p>\n<p> &#8230; and then the Javascript &#8230;<\/p>\n<p><code><br \/>\nfunction augmentselects() {<br \/>\n  var aftersp='', optbitshere=[], jopts, thisoptih='', findings=[], jfindings, isotwois='', afteri='', adone='<font color=blue>', afterj=''<\/font>;<br \/>\n  var selihis=document.getElementById('timezone').innerHTML;<br \/>\n  <font color=blue>var tzi=-90;<\/font><br \/>\n  aftersp=selihis;<br \/>\n  optbitshere=selihis.split('&lt;\/option&gt;');<br \/>\n  for (jopts=0; jopts&lt;optbitshere.length; jopts++) {<br \/>\n    thisoptih=optbitshere[jopts].split('&gt;')[eval(-1 + optbitshere[jopts].split('&gt;').length)];<br \/>\n    if (thisoptih.trim() != '') {<br \/>\n      afteri='';<br \/>\n      <font color=blue>afterj='';<\/font><br \/>\n      adone='';<br \/>\n      findings=seleih.split((',+' + thisoptih.replace('Greenwich Mean Time', '0') + '\"').replace('+-','-'));<br \/>\n    \/\/console.log(thisoptih + ' ... ' + ('\",\"+' + thisoptih.replace('Greenwich Mean Time', '0') + '\"').replace('+-','-') + ' --- ' + findings.length);<br \/>\n      for (jfindings=0; jfindings&lt;findings.length; jfindings++) {<br \/>\n        isotwois=findings[jfindings].split(',')[eval(-1 + findings[jfindings].split(',').length)];<br \/>\n       <font color=blue> tzi=-90;<br \/>\n        if (1 == 1 || eval(1 + eval('' + jfindings)) &lt; eval('' + findings.length)) {<br \/>\n        tzi=thisoptih.replace('Greenwich Mean Time', '0'); \/\/findings[eval(1 + eval('' + jfindings))].split(',')[0].split('&gt;')[0].split('\"')[0].split(\"'\")[0];<br \/>\n        console.log('tzi=' + tzi);<br \/>\n        }<\/font><br \/>\n    \/\/console.log(isotwois);<br \/>\n        if (('' + isotwois).length == 2) {<br \/>\n          <font color=blue>if (selceqih.indexOf('\"' + isotwois + '\"&gt;') != -1) {<br \/>\n              if (afterj == '') {<br \/>\n                afterj+=' ' + selceqih.split('\"' + isotwois + '\"&gt;')[1].split('&lt;')[0].replace(\/\\'\/g, '`').replace(\/\\\"\/g, '`');<br \/>\n              } else {<br \/>\n                afterj+=', ' + selceqih.split('\"' + isotwois + '\"&gt;')[1].split('&lt;')[0].replace(\/\\'\/g, '`').replace(\/\\\"\/g, '`');<br \/>\n              }<br \/>\n        console.log('afterj=' + afterj);<br \/>\n      if (afterj != '' && document.getElementById(('o' + tzi).replace('+',''))) {<br \/>\n        console.log('afterj found=' + afterj);<br \/>\n          if (document.getElementById(('o' + tzi).replace('+','')).title.indexOf(afterj) == -1) {<br \/>\n           if ((document.getElementById(('o' + tzi).replace('+','')).title + '~').indexOf(': ~') == -1) {<br \/>\n             if (('' + document.getElementById(('o' + tzi).replace('+','')).title).indexOf(',') == -1) {<br \/>\n             aftersp=aftersp.replace('\" id=\"o' + ('' + tzi).replace('+','') + '\"', afterj + ',\" id=\"o' + ('' + tzi).replace('+','') + '\"');<br \/>\n             } else {<br \/>\n             aftersp=aftersp.replace('\" id=\"o' + ('' + tzi).replace('+','') + '\"', ' ' + afterj + ',\" id=\"o' + ('' + tzi).replace('+','') + '\"');<br \/>\n             }<br \/>\n             document.getElementById(('o' + tzi).replace('+','')).title+=',' + afterj.replace(',','');<br \/>\n           } else {<br \/>\n             aftersp=aftersp.replace('\" id=\"o' + ('' + tzi).replace('+','') + '\"', ',' + afterj + ',\" id=\"o' + ('' + tzi).replace('+','') + '\"');<br \/>\n             document.getElementById(('o' + tzi).replace('+','')).title+='' + afterj.replace(',','');<br \/>\n           }<br \/>\n          }<br \/>\n          afterj='';<br \/>\n      }<br \/>\n          }<\/font><br \/>\n          if (adone.indexOf(isotwois + ',') == -1) {<br \/>\n            adone+=isotwois + ',';<br \/>\n            afteri+=' ' + orflag(isotwois);<br \/>\n          }<br \/>\n        }<br \/>\n      }<br \/>\n      if (afteri != '') {<br \/>\n        aftersp=aftersp.replace('&gt;' + thisoptih + '&lt;', '&gt;' + thisoptih + afteri + '&lt;');<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n  afters[0]=aftersp;<br \/>\n  document.getElementById('timezone').innerHTML=aftersp<font color=blue>.replace(\/\\,\\\"\\ id\\=\/g, '\" id=').replace(\/\\:\\ \\,\/g, ': ').replace(\/\\:\\ \\ \\,\/g, ': ')<\/font>;<br \/>\n  selihis=document.getElementById('region').innerHTML;<br \/>\n  aftersp=selihis;<br \/>\n  optbitshere=selihis.split('&lt;\/option&gt;');<br \/>\n  for (jopts=0; jopts&lt;optbitshere.length; jopts++) {<br \/>\n    thisoptih=optbitshere[jopts].split('&gt;')[eval(-1 + optbitshere[jopts].split('&gt;').length)];<br \/>\n    if (thisoptih.trim() != '') {<br \/>\n      afteri='';<br \/>\n      adone='';<br \/>\n      findings=seleih.split((' value=\"' + thisoptih + '\/'));<br \/>\n    \/\/console.log(thisoptih + ' ... ' + ('\",\"+' + thisoptih.replace('Greenwich Mean Time', '0') + '\"').replace('+-','-') + ' --- ' + findings.length);<br \/>\n      if (eval('' + findings.length) &gt;= 2) {<br \/>\n      for (jfindings=1; jfindings&lt;findings.length; jfindings++) {<br \/>\n       isotwois=findings[jfindings].split(',')[3];<br \/>\n    \/\/console.log(isotwois);<br \/>\n        if (('' + isotwois).length == 2) {<br \/>\n          if (adone.indexOf(isotwois + ',') == -1) {<br \/>\n            adone+=isotwois + ',';<br \/>\n            afteri+=' ' + orflag(isotwois);<br \/>\n          }<br \/>\n       }<br \/>\n      }<br \/>\n      }<br \/>\n      if (afteri != '') {<br \/>\n        aftersp=aftersp.replace('&gt;' + thisoptih + '&lt;', '&gt;' + thisoptih + afteri + '&lt;');<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n  document.getElementById('region').innerHTML=aftersp;<br \/>\n  afters[1]=aftersp;<br \/>\n  selihis=document.getElementById('sfrom').innerHTML;<br \/>\n  \/\/var cselceq=document.getElementById('selceq').innerHTML;<br \/>\n  aftersp=selihis;<br \/>\n  optbitshere=selihis.split('&lt;\/option&gt;');<br \/>\n  for (jopts=0; jopts&lt;optbitshere.length; jopts++) {<br \/>\n    thisoptih=optbitshere[jopts].split('&gt;')[eval(-1 + optbitshere[jopts].split('&gt;').length)];<br \/>\n    if (thisoptih.trim() != '') {<br \/>\n      <font color=blue>afterj='';<\/font><br \/>\n      afteri='';<br \/>\n      \/\/adone='';<br \/>\n      findings=seleih.split((' value=\"' + thisoptih + '\"'));<br \/>\n    \/\/console.log(thisoptih + ' ... ' + ('\",\"+' + thisoptih.replace('Greenwich Mean Time', '0') + '\"').replace('+-','-') + ' --- ' + findings.length);<br \/>\n      if (findings.length &gt;= 2) {<br \/>\n       isotwois=findings[1].split(',')[3];<br \/>\n    \/\/console.log(isotwois);<br \/>\n        if (('' + isotwois).length == 2) {<br \/>\n          \/\/if (adone.indexOf(isotwois + ',') == -1) {<br \/>\n            \/\/adone+=isotwois + ',';<br \/>\n            if (selceqih.indexOf('\"' + isotwois + '\"&gt;') != -1) {<br \/>\n              <font color=blue>if (afterj == '') {<br \/>\n                afterj+=' ' + selceqih.split('\"' + isotwois + '\"&gt;')[1].split('&lt;')[0].replace(\/\\'\/g, '`').replace(\/\\\"\/g, '`');<br \/>\n              } else {<br \/>\n                afterj+=', ' + selceqih.split('\"' + isotwois + '\"&gt;')[1].split('&lt;')[0].replace(\/\\'\/g, '`').replace(\/\\\"\/g, '`');<br \/>\n              }<\/font><br \/>\n              afteri+=' in ' + orflag(isotwois) + ' ' + selceqih.split('\"' + isotwois + '\"&gt;')[1].split('&lt;')[0].replace(\/\\'\/g, '`').replace(\/\\\"\/g, '`');<br \/>\n            } else {<br \/>\n              afteri+=' in ' + orflag(isotwois);<br \/>\n            }<br \/>\n          \/\/}<br \/>\n       }<br \/>\n      }<br \/>\n      <font color=blue>if (afterj != '' && document.getElementById('o' + thisoptih.toLowerCase().split('\/')[0])) {<br \/>\n          if (document.getElementById('o' + thisoptih.toLowerCase().split('\/')[0]).title.indexOf(afterj) == -1) {<br \/>\n           if ((document.getElementById('o' + thisoptih.toLowerCase().split('\/')[0]).title + '~').indexOf(': ~') == -1) {<br \/>\n             document.getElementById('o' + thisoptih.toLowerCase().split('\/')[0]).title+=',' + afterj.replace(',','');<br \/>\n           } else {<br \/>\n             document.getElementById('o' + thisoptih.toLowerCase().split('\/')[0]).title+='' + afterj.replace(',','');<br \/>\n          }<br \/>\n          }<br \/>\n      }<\/font><br \/>\n      if (afteri != '') {<br \/>\n        \/\/alert('thisoptih=' + thisoptih + ' afterj=' + afterj);<br \/>\n        aftersp=aftersp.replace('&gt;' + thisoptih + '&lt;', '&gt;' + thisoptih + afteri + '&lt;'); \/\/.replace(' title=\"' + thisoptih.substring(0,1).toUpperCase() + thisoptih.substring(1).toLowerCase() + ': \"', ' title=\"' + thisoptih.substring(0,1).toUpperCase() + thisoptih.substring(1).toLowerCase() + ': ' + afterj + '\"');<br \/>\n      } else if (thisoptih.indexOf(' in ') == -1) {<br \/>\n        \/\/alert('thisoptih=' + thisoptih + ' Afterj=' + afterj);<br \/>\n        aftersp=aftersp.replace('&gt;' + thisoptih + '&lt;', '&gt;' + thisoptih + ' in ' + '&lt;');<br \/>\n      }<br \/>\n    }<br \/>\n  }<br \/>\n  document.getElementById('sfrom').innerHTML=aftersp.replace(' can go in at ', ' at ');<br \/>\n  afters[2]=aftersp;<br \/>\n  document.getElementById('sto').innerHTML=aftersp.replace(' can go in at ', ' at ').replace(' left', ' right');<br \/>\n  afters[3]=aftersp.replace(' can go in at ', ' at ').replace(' left', ' right');<br \/>\n  \/\/selihis=document.getElementById('sto').innerHTML;<br \/>\n  \/\/aftersp=selihis;<br \/>\n  \/\/document.getElementById('sto').innerHTML=aftersp;<br \/>\n}<br \/>\n<\/code><\/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\/new-safari-web-inspector-network-tab-headers-php-post-tutorial\/'>New Safari Web Inspector Network Tab Headers PHP Post Tutorial<\/a>.<\/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='#d56080' onclick='var dv=document.getElementById(\"d56080\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/option\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d56080' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve many a time dreamed up web applications that would fill an HTML select element&#8217;s option tag innerHTMLs with image data. But no, the select element has, like the Javascript popup windows, a lot of underlying operating system workings making &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/daylight-saving-time-select-option-title-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":[112,301,2652,385,576,652,2273,997,1866,1279,2167,1319],"class_list":["post-56080","post","type-post","status-publish","format-standard","hentry","category-elearning","category-event-driven-programming","category-tutorials","tag-attribute","tag-date","tag-daylight-saving","tag-emoji","tag-html","tag-javascript","tag-option","tag-programming","tag-select","tag-time","tag-title","tag-tutorial"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56080"}],"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=56080"}],"version-history":[{"count":5,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56080\/revisions"}],"predecessor-version":[{"id":56085,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/56080\/revisions\/56085"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=56080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=56080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=56080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}