年数で違うページに移動させる
		
			
説明
			年数で違うページに移動させるにはDateオブジェクトのgetFullYear()メソッドを利用します。この値を調べて年別にページに移動させます。サンプルでは2010年の場合はindex2.htmlに、それ以外の年数の場合はindex1.htmlに移動します。
		
			
サンプルプログラム
【HTML】
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html lang="ja">
  <head>
  <meta http-equiv="content-type" content="text/html;charset=utf-8">
  <title>Sample</title>
  <link rel="stylesheet" href="css/main.css" type="text/css" media="all">
  <script type="text/javascript" src="js/sample.js"></script>
  </head>
  <body>
  <h1>年数で違うページに移動させる</h1>
  <p>2010年のページはindex2.htmlに移動します。2010年以外の場合はindex1.htmlに移動します</p>
  </body>
  </html>
  
  【sample.js】
var dateObj = new Date();
var jumpURL = "index1.html";
if (dateObj.getFullYear() == 2010) { jumpURL = "index2.html"; }
location.href = jumpURL;