{"id":492,"date":"2009-10-20T22:43:16","date_gmt":"2009-10-20T13:43:16","guid":{"rendered":"http:\/\/devel.vitalify.jp\/wp_admin\/?p=492"},"modified":"2012-11-12T19:53:13","modified_gmt":"2012-11-12T10:53:13","slug":"post_389","status":"publish","type":"post","link":"https:\/\/vitalify.jp\/blog\/2009\/10\/post_389.html","title":{"rendered":"\u8eca\u8f2a\u306e\u518d\u767a\u660e &#8211; \u6708\u5225\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u751f\u6210\u3059\u308bJavascript"},"content":{"rendered":"<p>\u7a7a\u6c17\u3092\u8aad\u307e\u305a\u306b\u6708\u5225\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u751f\u6210\u3059\u308bJavascript\u3092\u66f8\u3044\u305f\u306e\u3067\u3054\u7d39\u4ecb\u3067\u3059\u3002<br \/>jQuery\u306a\u3069\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u4f7f\u3063\u3066\u306a\u3044\u306e\u3067\u597d\u304d\u306a\u3082\u306e\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u3048\u307e\u3059\u3002<br \/><a href=\"http:\/\/storage.vitalify.jp\/staff\/akato\/blog\/js\/calender\/\">sample\u30da\u30fc\u30b8\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/a><\/p>\n<p>\u4f7f\u3044\u65b9\u306f\u7c21\u5358<\/p>\n<h3>1.new\u3057\u3066\u3084\u308a\u3064\u3064\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u306b\u5024\u3092\u6e21\u3057\u3066<\/h3>\n<dl>\n<dt>config.caption<\/dt>\n<dd>\u30ad\u30e3\u30d7\u30b7\u30e7\u30f3\u306e\u6709\u7121 (true | false),\u30c7\u30d5\u30a9\u30eb\u30c8\u306ffalse<\/dd>\n<dd>config.className<\/dd>\n<dd>\u30ab\u30ec\u30f3\u30c0\u30fc\u306e\u30c6\u30fc\u30d6\u30eb\u3084\u30bb\u30eb\u306b\u4ed8\u304f\u30af\u30e9\u30b9\u540d\u3084ID\u306e\u63a5\u982d\u5024,\u30c7\u30d5\u30a9\u30eb\u30c8\u306f&#8217;calender&#8217;<\/dd>\n<dd>config.daynames<\/dd>\n<dd>\u30c7\u30d5\u30a9\u30eb\u30c8\u306f[&#8216;\u65e5&#8217;,&#8217;\u6708&#8217;,&#8217;\u706b&#8217;,&#8217;\u6c34&#8217;,&#8217;\u6728&#8217;,&#8217;\u91d1&#8217;,&#8217;\u571f&#8217;]\u66dc\u65e5\u30e9\u30d9\u30eb\u3092\u914d\u5217\u3067<\/dd>\n<dd>config.dayclass<\/dd>\n<dd>\u30c7\u30d5\u30a9\u30eb\u30c8\u306f[&#8216;sun&#8217;,&#8217;mon&#8217;,&#8217;tue&#8217;,&#8217;wed&#8217;,&#8217;thu&#8217;,&#8217;fri&#8217;,&#8217;sat&#8217;]\u66dc\u65e5\u306e\u30af\u30e9\u30b9\u540d\u3092\u914d\u5217\u3067 <\/dd>\n<\/dl>\n<h3>\n2.\u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3076<\/h3>\n<ul>\n<li>\ncalenderClass.make_cal_today()\uff1a\u4eca\u65e5\u3092\u57fa\u6e96\u306b\u4eca\u6708\u306e\u30ab\u30ec\u30f3\u30c0\u30fc<\/li>\n<li>\ncalenderClass.make_cal_today(-1,2)\uff1a\u4eca\u65e5\u3092\u57fa\u6e96\u306b\u5f15\u65701\u3092\u5e74\u306b\u3001\u5f15\u65702\u3092\u6708\u306b\u8db3\u3057\u305f\u30ab\u30ec\u30f3\u30c0\u30fc\uff08\u4f8b:\u53bb\u5e74\u306e\u518d\u6765\u6708\uff09<\/li>\n<li>\ncalenderClass.make_cal_monthly(2009,12)\uff1a\u6307\u5b9a\u5e74,\u6708\u306e\u30ab\u30ec\u30f3\u30c0\u30fc<\/li>\n<\/ul>\n<h3>3.\u623b\u308a\u5024<\/h3>\n<p>\u623b\u308a\u5024\u306f\u30c6\u30fc\u30d6\u30eb\u30bf\u30b0\u306eHTML\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5f62\u5f0f\u3067\u3059\u3002\u306a\u306e\u3067\u305d\u306e\u307e\u307e`innerHTML\u306f\u3067\u304d\u307e\u305b\u3093\u3002appendChild\u3068\u304b\u3067\u304a\u9858\u3044\u3057\u307e\u3059\u3002<\/p>\n<h3>4.\u3053\u3093\u306a\u3093\u306b\u306a\u308b<\/h3>\n<ul>\n<li>th\u3001td\u306b\u306f\u66dc\u65e5\u306e\u30af\u30e9\u30b9\u540d\u3068config.className+&#8221;Date&#8221;+${date}\u304cID\u306b\u30bb\u30c3\u30c8\u3055\u308c\u308b<\/li>\n<li>\u5f53\u65e5\u306e\u30bb\u30eb\u306b\u306frel=&#8221;today&#8221;\u304c\u30bb\u30c3\u30c8\u3055\u308c\u308b<\/li>\n<\/ul>\n<p>\u672c\u5f53\u306b\u306a\u3093\u306e\u7279\u5fb4\u3082\u306a\u3044\u666e\u901a\u306e\u30ab\u30ec\u30f3\u30c0\u30fc\u751f\u6210\u3067\u3059\u304c\u610f\u5916\u3068\u3044\u3044\u306e\u306a\u3044\u6c17\u304c\u3059\u308b\u3093\u3067\u3059\u3088\u306d\u30fc\u63a2\u3057\u3066\u306a\u3044\u3060\u3051\u306a\u3044\u6c17\u304c\u3057\u307e\u3059\u304c\u3002<br \/>\u30c7\u30b6\u30a4\u30f3\u306fCSS\u3067\u3084\u308b\u304b\u3089\u30c7\u30b6\u30a4\u30f3\u8981\u7d20\u5165\u308c\u306a\u3044\u3067\uff01\u3063\u3066\u3044\u3046\u3053\u3046\u3044\u3046\u30b7\u30f3\u30d7\u30eb\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u597d\u304d\u3067\u3059\u3002<br \/>\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f\u7d9a\u304d\u304b\u3089\u3002\u3054\u81ea\u7531\u306b\u3069\u3046\u305e\u3002\u4e0d\u5177\u5408\u306f\u3054\u5831\u544a\u3044\u305f\u3060\u3051\u308b\u3068\u52c9\u5f37\u306b\u306a\u308a\u307e\u3059\uff01<br \/>\uff08\u305f\u3060\u3057\u3001\u3053\u306e\u30b3\u30fc\u30c9\u3092\u5229\u7528\u3057\u3066\u8d77\u3053\u3063\u305f\u3044\u304b\u306a\u308b\u3053\u3068\u306b\u3082\u8cac\u4efb\u306f\u6301\u3061\u307e\u305b\u3093\u3002\uff09<\/p>\n<p><!--more--><\/p>\n<pre><span style=\"color: rgb(0, 128, 128);\">var<\/span> _calenderClass = <span style=\"color: rgb(0, 128, 128);\">function<\/span>(config)<span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/>  <span style=\"color: rgb(0, 0, 192);\">\/\/set default vlues<\/span><br \/>  <span style=\"color: rgb(128, 64, 0);\">if<\/span>(!config) <span style=\"color: rgb(0, 128, 128);\">var<\/span> config = <span style=\"color: rgb(0, 128, 128);\">{}<\/span>;<br \/>  <span style=\"color: rgb(0, 128, 128);\">this<\/span>.iscaption  = (<span style=\"color: rgb(128, 64, 0);\">typeof<\/span> config.caption   != <span style=\"color: rgb(192, 0, 0);\">\"undefined\"<\/span>) ? config.caption : <span style=\"color: rgb(192, 0, 0);\">false<\/span>;<br \/>  <span style=\"color: rgb(0, 128, 128);\">this<\/span>.className  = (<span style=\"color: rgb(128, 64, 0);\">typeof<\/span> config.className != <span style=\"color: rgb(192, 0, 0);\">\"undefined\"<\/span>) ? config.className : <span style=\"color: rgb(192, 0, 0);\">'calender'<\/span>;<br \/>  <span style=\"color: rgb(0, 128, 128);\">this<\/span>.daynames   = (<span style=\"color: rgb(128, 64, 0);\">typeof<\/span> config.daynames  != <span style=\"color: rgb(192, 0, 0);\">\"undefined\"<\/span>) ? config.daynames : <span style=\"color: rgb(0, 128, 128);\">[<\/span><span style=\"color: rgb(192, 0, 0);\">'\u65e5'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'\u6708'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'\u706b'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'\u6c34'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'\u6728'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'\u91d1'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'\u571f'<\/span><span style=\"color: rgb(0, 128, 128);\">]<\/span>;<br \/>  <span style=\"color: rgb(0, 128, 128);\">this<\/span>.dayclass   = (<span style=\"color: rgb(128, 64, 0);\">typeof<\/span> config.dayclass  != <span style=\"color: rgb(192, 0, 0);\">\"undefined\"<\/span>) ? config.dayclass : <span style=\"color: rgb(0, 128, 128);\">[<\/span><span style=\"color: rgb(192, 0, 0);\">'sun'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'mon'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'tue'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'wed'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'thu'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'fri'<\/span>,<span style=\"color: rgb(192, 0, 0);\">'sat'<\/span><span style=\"color: rgb(0, 128, 128);\">]<\/span>;<br \/>  <span style=\"color: rgb(0, 128, 128);\">var<\/span> DateObj = <span style=\"color: rgb(128, 64, 0);\">new<\/span> <span style=\"color: rgb(0, 128, 0);\">Date<\/span>();<br \/>  <span style=\"color: rgb(0, 128, 128);\">this<\/span>.today = <span style=\"color: rgb(0, 128, 128);\">[<\/span>DateObj.getDate(),DateObj.getMonth(),DateObj.getFullYear()<span style=\"color: rgb(0, 128, 128);\">]<\/span>;<br \/>  <span style=\"color: rgb(128, 64, 0);\">return<\/span> <span style=\"color: rgb(0, 128, 128);\">this<\/span>;<br \/><br \/><span style=\"color: rgb(0, 128, 128);\">}<\/span>;<br \/>_calenderClass.prototype = <span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/>  leap: <span style=\"color: rgb(0, 128, 128);\">function<\/span>(year)<span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/>    <span style=\"color: rgb(128, 64, 0);\">return<\/span> year % 4 ? 0 : year % 100 ? 1 : year % 400 ? 0 : 1;<br \/>  <span style=\"color: rgb(0, 128, 128);\">}<\/span>,<br \/>  make_cal_array: <span style=\"color: rgb(0, 128, 128);\">function<\/span>(year,monthly)<span style=\"color: rgb(0, 128, 128);\">{<\/span><span style=\"color: rgb(0, 0, 192);\">\/\/1year days<\/span><br \/><br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> months = <span style=\"color: rgb(0, 128, 128);\">[<\/span>31, 28 + <span style=\"color: rgb(0, 128, 128);\">this<\/span>.leap(year), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31<span style=\"color: rgb(0, 128, 128);\">]<\/span>;<br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> result = <span style=\"color: rgb(0, 128, 128);\">[]<\/span>;<br \/>    <span style=\"color: rgb(128, 64, 0);\">for<\/span> (<span style=\"color: rgb(0, 128, 128);\">var<\/span> month = 0; month &lt; 12; month++)<span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/><br \/>      result<span style=\"color: rgb(0, 128, 128);\">[<\/span>month<span style=\"color: rgb(0, 128, 128);\">]<\/span> = <span style=\"color: rgb(0, 128, 128);\">[]<\/span>;<br \/>      <span style=\"color: rgb(0, 128, 128);\">var<\/span> date1day = (<span style=\"color: rgb(128, 64, 0);\">new<\/span> <span style=\"color: rgb(0, 128, 0);\">Date<\/span>(year, month, 1, 0, 0, 0)).getDay();<br \/>      <span style=\"color: rgb(0, 128, 128);\">var<\/span> dateLastDay = (<span style=\"color: rgb(128, 64, 0);\">new<\/span> <span style=\"color: rgb(0, 128, 0);\">Date<\/span>(year, month, months<span style=\"color: rgb(0, 128, 128);\">[<\/span>month<span style=\"color: rgb(0, 128, 128);\">]<\/span>, 0, 0, 0)).getDay();<br \/>      <span style=\"color: rgb(128, 64, 0);\">for<\/span> (<span style=\"color: rgb(0, 128, 128);\">var<\/span> <span style=\"color: rgb(0, 128, 0);\">date<\/span> = 1; <span style=\"color: rgb(0, 128, 0);\">date<\/span> &lt;= months<span style=\"color: rgb(0, 128, 128);\">[<\/span>month<span style=\"color: rgb(0, 128, 128);\">]<\/span>+(6-dateLastDay); <span style=\"color: rgb(0, 128, 0);\">date<\/span>++)<span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/><br \/>        <span style=\"color: rgb(128, 64, 0);\">if<\/span>(<span style=\"color: rgb(0, 128, 0);\">date<\/span> &lt;= months<span style=\"color: rgb(0, 128, 128);\">[<\/span>month<span style=\"color: rgb(0, 128, 128);\">]<\/span> &amp;&amp; monthly) <span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/>          result<span style=\"color: rgb(0, 128, 128);\">[<\/span>month<span style=\"color: rgb(0, 128, 128);\">][<\/span><span style=\"color: rgb(0, 128, 0);\">date<\/span> + date1day - 1<span style=\"color: rgb(0, 128, 128);\">]<\/span> = <span style=\"color: rgb(0, 128, 0);\">date<\/span>;<br \/>        <span style=\"color: rgb(0, 128, 128);\">}<\/span><span style=\"color: rgb(128, 64, 0);\">else<\/span> <span style=\"color: rgb(128, 64, 0);\">if<\/span>(<span style=\"color: rgb(0, 128, 0);\">date<\/span> &lt;= months<span style=\"color: rgb(0, 128, 128);\">[<\/span>month<span style=\"color: rgb(0, 128, 128);\">]<\/span>)<span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/><br \/>          result<span style=\"color: rgb(0, 128, 128);\">[<\/span>month<span style=\"color: rgb(0, 128, 128);\">][<\/span><span style=\"color: rgb(0, 128, 0);\">date<\/span> - 1<span style=\"color: rgb(0, 128, 128);\">]<\/span> = <span style=\"color: rgb(0, 128, 0);\">date<\/span>;<br \/>        <span style=\"color: rgb(0, 128, 128);\">}<\/span><span style=\"color: rgb(128, 64, 0);\">else<\/span> <span style=\"color: rgb(128, 64, 0);\">if<\/span>(monthly) <span style=\"color: rgb(0, 128, 128);\">{<\/span><span style=\"color: rgb(0, 0, 192);\">\/\/to table cell remainder<\/span><br \/><br \/>          result<span style=\"color: rgb(0, 128, 128);\">[<\/span>month<span style=\"color: rgb(0, 128, 128);\">][<\/span><span style=\"color: rgb(0, 128, 0);\">date<\/span> + date1day - 1<span style=\"color: rgb(0, 128, 128);\">]<\/span> = <span style=\"color: rgb(192, 0, 0);\">false<\/span>;<br \/>        <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/>      <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/><br \/>    <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/>    <span style=\"color: rgb(128, 64, 0);\">return<\/span> result;<br \/>  <span style=\"color: rgb(0, 128, 128);\">}<\/span>,<br \/>  make_cal_monthly: <span style=\"color: rgb(0, 128, 128);\">function<\/span>(year, month)<span style=\"color: rgb(0, 128, 128);\">{<\/span><span style=\"color: rgb(0, 0, 192);\">\/\/make calender<\/span><br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> monthLabel = month - 1;<span style=\"color: rgb(0, 0, 192);\">\/\/to Array label<\/span><br \/><br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> cal = <span style=\"color: rgb(0, 128, 128);\">this<\/span>.make_cal_array(year,<span style=\"color: rgb(192, 0, 0);\">true<\/span>);<br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> table = <span style=\"color: rgb(128, 64, 0);\">document<\/span>.createElement(<span style=\"color: rgb(192, 0, 0);\">'table'<\/span>);<br \/>    <span style=\"color: rgb(0, 0, 192);\">\/\/ header<\/span><br \/><br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> tr = <span style=\"color: rgb(128, 64, 0);\">document<\/span>.createElement\n(<span style=\"color: rgb(192, 0, 0);\">'tr'<\/span>);<br \/>    <span style=\"color: rgb(128, 64, 0);\">for<\/span> (<span style=\"color: rgb(0, 128, 128);\">var<\/span> day = 0; day &lt; 7; day++)<span style=\"color: rgb(0, 128, 128);\">{<\/span><span style=\"color: rgb(0, 0, 192);\">\/\/label of day<\/span><br \/><br \/>      <span style=\"color: rgb(0, 128, 128);\">var<\/span> th = <span style=\"color: rgb(128, 64, 0);\">document<\/span>.createElement(<span style=\"color: rgb(192, 0, 0);\">'th'<\/span>);<br \/>      th.innerHTML = <span style=\"color: rgb(0, 128, 128);\">this<\/span>.daynames<span style=\"color: rgb(0, 128, 128);\">[<\/span>day<span style=\"color: rgb(0, 128, 128);\">]<\/span>;<br \/>      th.className = <span style=\"color: rgb(0, 128, 128);\">this<\/span>.dayclass<span style=\"color: rgb(0, 128, 128);\">[<\/span>day<span style=\"color: rgb(0, 128, 128);\">]<\/span>;<br \/>      tr.appendChild(th);<br \/>    <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/><br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> thead = <span style=\"color: rgb(128, 64, 0);\">document<\/span>.createElement(<span style=\"color: rgb(192, 0, 0);\">'thead'<\/span>);<br \/>    thead.appendChild(tr);<br \/>    table.appendChild(thead);<br \/>    <span style=\"color: rgb(0, 0, 192);\">\/\/ body;<\/span><br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> tbody = <span style=\"color: rgb(128, 64, 0);\">document<\/span>.createElement(<span style=\"color: rgb(192, 0, 0);\">'tbody'<\/span>);<br \/>    <span style=\"color: rgb(128, 64, 0);\">for<\/span> (<span style=\"color: rgb(0, 128, 128);\">var<\/span> <span style=\"color: rgb(0, 128, 0);\">date<\/span> = 0, fullday = cal<span style=\"color: rgb(0, 128, 128);\">[<\/span>monthLabel<span style=\"color: rgb(0, 128, 128);\">]<\/span>.length; <span style=\"color: rgb(0, 128, 0);\">date<\/span> &lt; fullday; <span style=\"color: rgb(0, 128, 0);\">date<\/span>++)<span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/><br \/>      <span style=\"color: rgb(128, 64, 0);\">if<\/span> (<span style=\"color: rgb(0, 128, 0);\">date<\/span> % 7 == 0) tr = <span style=\"color: rgb(128, 64, 0);\">document<\/span>.createElement(<span style=\"color: rgb(192, 0, 0);\">'tr'<\/span>);<br \/>      <span style=\"color: rgb(0, 128, 128);\">var<\/span> td = <span style=\"color: rgb(128, 64, 0);\">document<\/span>.createElement(<span style=\"color: rgb(192, 0, 0);\">'td'<\/span>);<br \/>      <span style=\"color: rgb(128, 64, 0);\">if<\/span>(<span style=\"color: rgb(0, 128, 128);\">this<\/span>.today<span style=\"color: rgb(0, 128, 128);\">[<\/span>0<span style=\"color: rgb(0, 128, 128);\">]<\/span> == <span style=\"color: rgb(0, 128, 0);\">date<\/span> &amp;&amp; <span style=\"color: rgb(0, 128, 128);\">this<\/span>.today<span style=\"color: rgb(0, 128, 128);\">[<\/span>1<span style=\"color: rgb(0, 128, 128);\">]<\/span> == monthLabel &amp;&amp;  <span style=\"color: rgb(0, 128, 128);\">this<\/span>.today<span style=\"color: rgb(0, 128, 128);\">[<\/span>2<span style=\"color: rgb(0, 128, 128);\">]<\/span> == year) <span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/><br \/>        td.setAttribute(<span style=\"color: rgb(192, 0, 0);\">\"rel\"<\/span>,<span style=\"color: rgb(192, 0, 0);\">\"today\"<\/span>);<span style=\"color: rgb(0, 0, 192);\">\/\/today attribute<\/span><br \/>      <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/>      td.id = (<span style=\"color: rgb(128, 64, 0);\">typeof<\/span> cal<span style=\"color: rgb(0, 128, 128);\">[<\/span>monthLabel<span style=\"color: rgb(0, 128, 128);\">][<\/span><span style=\"color: rgb(0, 128, 0);\">date<\/span><span style=\"color: rgb(0, 128, 128);\">]<\/span> != <span style=\"color: rgb(192, 0, 0);\">\"undefined\"<\/span>) ? <span style=\"color: rgb(0, 128, 128);\">this<\/span>.className + <span style=\"color: rgb(192, 0, 0);\">\"Date\"<\/span> + cal<span style=\"color: rgb(0, 128, 128);\">[<\/span>monthLabel<span style=\"color: rgb(0, 128, 128);\">][<\/span><span style=\"color: rgb(0, 128, 0);\">date<\/span><span style=\"color: rgb(0, 128, 128);\">]<\/span> : <span style=\"color: rgb(192, 0, 0);\">\"\"<\/span>;<span style=\"color: rgb(0, 0, 192);\">\/\/set id name for date<\/span><br \/><br \/>      <span style=\"color: rgb(128, 64, 0);\">if<\/span> (cal<span style=\"color: rgb(0, 128, 128);\">[<\/span>monthLabel<span style=\"color: rgb(0, 128, 128);\">][<\/span><span style=\"color: rgb(0, 128, 0);\">date<\/span><span style=\"color: rgb(0, 128, 128);\">]<\/span>)<span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/>        td.innerHTML = cal<span style=\"color: rgb(0, 128, 128);\">[<\/span>monthLabel<span style=\"color: rgb(0, 128, 128);\">][<\/span><span style=\"color: rgb(0, 128, 0);\">date<\/span><span style=\"color: rgb(0, 128, 128);\">]<\/span>;<br \/>        td.className = <span style=\"color: rgb(0, 128, 128);\">this<\/span>.dayclass<span style=\"color: rgb(0, 128, 128);\">[<\/span><span style=\"color: rgb(0, 128, 0);\">date<\/span> % 7<span style=\"color: rgb(0, 128, 128);\">]<\/span>;<span style=\"color: rgb(0, 0, 192);\">\/\/add class<\/span><br \/><br \/>      <span style=\"color: rgb(0, 128, 128);\">}<\/span><span style=\"color: rgb(128, 64, 0);\">else<\/span> <span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/>        td.className = <span style=\"color: rgb(192, 0, 0);\">\"nodate\"<\/span>;<span style=\"color: rgb(0, 0, 192);\">\/\/add class nodate<\/span><br \/>        td.innerHTML = <span style=\"color: rgb(192, 0, 0);\">\"&amp;nbsp;\"<\/span>;<br \/>      <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/><br \/>      tr.appendChild(td);<br \/>      <span style=\"color: rgb(128, 64, 0);\">if<\/span> (<span style=\"color: rgb(0, 128, 0);\">date<\/span> % 7 == 6) tbody.appendChild(tr);<br \/>    <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/>    tbody.appendChild(tr);<br \/>    table.className = <span style=\"color: rgb(0, 128, 128);\">this<\/span>.className;<span style=\"color: rgb(0, 0, 192);\">\/\/add id for table<\/span><br \/>    table.id        = <span style=\"color: rgb(0, 128, 128);\">this<\/span>.className + year + <span style=\"color: rgb(192, 0, 0);\">\"-\"<\/span> + month;<span style=\"color: rgb(0, 0, 192);\">\/\/add id for table<\/span><br \/><br \/>    table.setAttribute(<span style=\"color: rgb(192, 0, 0);\">\"rel\"<\/span>,(year +<span style=\"color: rgb(192, 0, 0);\">\"-\"<\/span>+ (month)));<br \/>    <span style=\"color: rgb(128, 64, 0);\">if<\/span>(<span style=\"color: rgb(0, 128, 128);\">this<\/span>.iscaption) <span style=\"color: rgb(0, 128, 128);\">{<\/span><span style=\"color: rgb(0, 0, 192);\">\/\/is caption<\/span><br \/>      <span style=\"color: rgb(0, 128, 128);\">var<\/span> caption = <span style=\"color: rgb(128, 64, 0);\">document<\/span>.createElement(<span style=\"color: rgb(192, 0, 0);\">'caption'<\/span>);<br \/>      caption.innerHTML = year + <span style=\"color: rgb(192, 0, 0);\">'-'<\/span> + (month)+<span style=\"color: rgb(192, 0, 0);\">' JAPAN'<\/span>;<br \/>      table.appendChild(caption);<br \/>    <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/><br \/>    table.appendChild(tbody);<br \/>    <br \/>    <span style=\"color: rgb(128, 64, 0);\">return<\/span> table;<br \/>  <span style=\"color: rgb(0, 128, 128);\">}<\/span>,<br \/>  make_cal_today: <span style=\"color: rgb(0, 128, 128);\">function<\/span>(yearPlus,monthPlus)<span style=\"color: rgb(0, 128, 128);\">{<\/span><br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> monthPlus  = (<span style=\"color: rgb(128, 64, 0);\">typeof<\/span> monthPlus   != <span style=\"color: rgb(192, 0, 0);\">\"undefined\"<\/span>) ? monthPlus : 0;<br \/>    <span style=\"color: rgb(0, 128, 128);\">var<\/span> yearPlus   = (<span style=\"color: rgb(128, 64, 0);\">typeof<\/span>  yearPlus   != <span style=\"color: rgb(192, 0, 0);\">\"undefined\"<\/span>) ? yearPlus  : 0;<br \/>    <span style=\"color: rgb(128, 64, 0);\">return<\/span> <span style=\"color: rgb(0, 128, 128);\">this<\/span>.make_cal_monthly(<span style=\"color: rgb(0, 128, 128);\">this<\/span>.today<span style=\"color: rgb(0, 128, 128);\">[<\/span>2<span style=\"color: rgb(0, 128, 128);\">]<\/span> + yearPlus , <span style=\"color: rgb(0, 128, 128);\">this<\/span>.today<span style=\"color: rgb(0, 128, 128);\">[<\/span>1<span style=\"color: rgb(0, 128, 128);\">]<\/span> + monthPlus);<br \/>  <span style=\"color: rgb(0, 128, 128);\">}<\/span><br \/><br \/><span style=\"color: rgb(0, 128, 128);\">}<\/span>;<br \/><\/pre>\n<div class='wp_social_bookmarking_light'>\n            <div class=\"wsbl_facebook_like\"><div id=\"fb-root\"><\/div><fb:like href=\"https:\/\/vitalify.jp\/blog\/2009\/10\/post_389.html\" layout=\"button_count\" action=\"like\" share=\"false\" show_faces=\"false\" ><\/fb:like><\/div>\n            <div class=\"wsbl_google_plus_one\"><g:plusone size=\"medium\" annotation=\"none\" href=\"https:\/\/vitalify.jp\/blog\/2009\/10\/post_389.html\" ><\/g:plusone><\/div>\n            <div class=\"wsbl_hatena_button\"><a href=\"\/\/b.hatena.ne.jp\/entry\/https:\/\/vitalify.jp\/blog\/2009\/10\/post_389.html\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"\u8eca\u8f2a\u306e\u518d\u767a\u660e &#8211; \u6708\u5225\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u751f\u6210\u3059\u308bJavascript\" data-hatena-bookmark-layout=\"standard\" title=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\"> <img src=\"\/\/b.hatena.ne.jp\/images\/entry-button\/button-only@2x.png\" alt=\"\u3053\u306e\u30a8\u30f3\u30c8\u30ea\u30fc\u3092\u306f\u3066\u306a\u30d6\u30c3\u30af\u30de\u30fc\u30af\u306b\u8ffd\u52a0\" width=\"20\" height=\"20\" style=\"border: none;\" \/><\/a><script type=\"text\/javascript\" src=\"\/\/b.hatena.ne.jp\/js\/bookmark_button.js\" charset=\"utf-8\" async=\"async\"><\/script><\/div>\n            <div class=\"wsbl_tumblr\"><a href=\"\/\/www.tumblr.com\/share?v=3&u=https%3A%2F%2Fvitalify.jp%2Fblog%2F2009%2F10%2Fpost_389.html&t=%E8%BB%8A%E8%BC%AA%E3%81%AE%E5%86%8D%E7%99%BA%E6%98%8E%20%26%238211%3B%20%E6%9C%88%E5%88%A5%E3%82%AB%E3%83%AC%E3%83%B3%E3%83%80%E3%83%BC%E3%82%92%E7%94%9F%E6%88%90%E3%81%99%E3%82%8BJavascript\" title=\"Share on Tumblr\" style=\"display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('\/\/platform.tumblr.com\/v1\/share_1.png') top left no-repeat transparent;\">Share on Tumblr<\/a><\/div>\n            <div class=\"wsbl_twitter\"><a href=\"https:\/\/twitter.com\/share\" class=\"twitter-share-button\" data-url=\"https:\/\/vitalify.jp\/blog\/2009\/10\/post_389.html\" data-text=\"\u8eca\u8f2a\u306e\u518d\u767a\u660e &#8211; \u6708\u5225\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u751f\u6210\u3059\u308bJavascript\" data-lang=\"ja\">Tweet<\/a><\/div>\n    <\/div>\n<br class='wp_social_bookmarking_light_clear' \/>\n","protected":false},"excerpt":{"rendered":"<p>\u7a7a\u6c17\u3092\u8aad\u307e\u305a\u306b\u6708\u5225\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u751f\u6210\u3059\u308bJavascript\u3092\u66f8\u3044\u305f\u306e\u3067\u3054\u7d39\u4ecb\u3067\u3059\u3002jQuery\u306a\u3069\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u4f7f\u3063\u3066\u306a\u3044\u306e\u3067\u597d\u304d\u306a\u3082\u306e\u3068\u7d44\u307f\u5408\u308f\u305b\u3066\u4f7f\u3048\u307e\u3059\u3002sample\u30da\u30fc\u30b8\u306b\u3057\u3066\u307f\u307e\u3057\u305f\u3002 \u4f7f\u3044\u65b9\u306f\u7c21\u5358 1.new &hellip; <a href=\"https:\/\/vitalify.jp\/blog\/2009\/10\/post_389.html\" class=\"more-link more_btn\"><span class=\"screen-reader-text\">&#8220;\u8eca\u8f2a\u306e\u518d\u767a\u660e &#8211; \u6708\u5225\u30ab\u30ec\u30f3\u30c0\u30fc\u3092\u751f\u6210\u3059\u308bJavascript&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":36,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[1],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/posts\/492"}],"collection":[{"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/users\/36"}],"replies":[{"embeddable":true,"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/comments?post=492"}],"version-history":[{"count":1,"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/posts\/492\/revisions"}],"predecessor-version":[{"id":4045,"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/posts\/492\/revisions\/4045"}],"wp:attachment":[{"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/media?parent=492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/categories?post=492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vitalify.jp\/blog\/wp-json\/wp\/v2\/tags?post=492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}