Skip to content

Instantly share code, notes, and snippets.

@tomo3141592653
Created May 17, 2012 03:12
Show Gist options
  • Save tomo3141592653/2715939 to your computer and use it in GitHub Desktop.
Save tomo3141592653/2715939 to your computer and use it in GitHub Desktop.
今日がクリスマスの何なのか分かるページ
<p id="chiristmas" style="font-size: xx-large;">&nbsp;</p>
<script type="text/javascript">// <![CDATA[
var now =new Date();
var new_year = new Date("Dec 25, 2012 0:0:0");
var num_of_yoi = 1+( new_year.getTime() - now.getTime())/ 86400000;
field= document.getElementById('chiristmas');
var yois = "";
for (i=0;i<num_of_yoi;i++)
{
yois += "イブ";
}
if(num_of_yoi > 0){
field.innerHTML=("今夜はクリスマス"+yois+ "です。")
}
else{
field.innerHTML=("2012年クリスマスは終わりました。")
}
// ]]></script>
<p>注意:本当はイブに「前日の」という意味はありません。</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment