頑張りすぎ!?
明日から肉体労働だぜ。
義足を新調することにした。
見積りが約170万円!
国の税金でほぼ補填され、私は38000円の支払いだそうだ。
審査までに1ヶ月。
製作に1ヶ月。
このさい文句もいいますまい。
申し訳ない。納税者の皆様。
コンピュータ制御の膝になるらしい。ちょっと早足が可能だとか?
第3日曜日のみの日付を取得、セレクトボックスに
http://oshiete.goo.ne.jp/qa/8653394.html
<!DOCTYPE html> <meta charset="utf-8"> <body> <form id="hoge"> <p> <select id="fuga"></select> </form> <script> function getNoWeek (date, no, week) { var d = new Date (date.getFullYear (), date.getMonth (), 1); return (d.setDate (((week + 7) - d.getDay ()) % 7 + (no * 7 - 6)), d); } function getDai3Sunday (date) { return getNoWeek (date, 3, 0); } function createDateRangeByMonth (date, begin, end) { var result = [ ]; var d = new Date (date.getFullYear (), date.getMonth (), 1); d.setMonth (d.getMonth () + begin); for (var i = begin; i < end; i++) result.push (new Date (d)), d.setMonth (d.getMonth () + 1); return result; } function toString (date) { return date.toString (); } function toStringJp (date) { function padding (num) { return (num < 10 ? '0': '') + num; } return [ date.getFullYear (), padding (date.getMonth () + 1), padding (date.getDate ()) ].join ('-'); } function createOptions (text, value) { return text.reduce (function (frg, t, i) { frg.appendChild (new Option (t, value[i])); return frg; }, document.createDocumentFragment ()); } //____________________ var sun = createDateRangeByMonth (new Date, 0, 10).map (getDai3Sunday); document.querySelector ('#fuga').appendChild ( createOptions (sun.map (toStringJp), sun.map (toString))); </script> </body>
DOM操作後の状態を再現するには
http://oshiete.goo.ne.jp/qa/8652229.html
<?php $list = ''; $hoge = isset ($_POST['@hoge']) ? $_POST['@hoge']: array ('', ''); foreach ($hoge as $h) $list .= '<li><input type="text" name="@hoge[]" value="'.$h.'">'; ?> <!DOCTYPE html> <meta charset="utf-8"> <body> <form action="#" method="post" id="piyo"> <ol id="fuga"> <?php echo $list; ?> </ol> <input type="button" value="add"> / <input type="submit" value="submit"> </form> <script> function setValue (e) { e.value = this; } function addList (f) { var ol = f.querySelector ('#fuga'); var li = ol.querySelector ('li').cloneNode (true); Array.prototype.forEach.call ( li.querySelectorAll ('input'), setValue, ''); ol.appendChild (li); } function handle (event) { var e = event.target; if ('button' === e.type) if ('add' === e.value) addList (e.form); } document.addEventListener ('click', handle, false); </script>
指定した配列と一致したデータを削除したい
http://oshiete.goo.ne.jp/qa/8651072.html
<!DOCTYPE html> <meta charset="utf-8"> <body> <ul> <li class="del"> <a href="http://example.com ">A</a> <li class="del"> <a href="http://example.net/subdirectory/post.html ">B</a> <li class="del"> <a href="https://example.org ">C</a> <li class="del"> <a href="http://example.jp/subdirectory/post.html ">D</a> </ul> <a href="https://subdomain.example.org" class="del">E</a> <script> var ary = [ "http://example.com/", "http://example.net/", "https://subdomain.example.org", "http://example.jp/subdirectory" ]; function makeSelectorString (href) { return 'a[href^="' + href + '"]'; } function getParentByClass (e) { if (! e) throw new Error; return e.classList.contains (this) ? e : getParentByClass.call (this, e.parentNode) } function delChild (e) { e.parentNode.removeChild (e); } Array.prototype.map.call ( document.querySelectorAll (ary.map (makeSelectorString).join (',')), getParentByClass, 'del' ).forEach (delChild); </script> </body>