指定月のカレンダーを表示する

書式

calendarObj.setMonth(month)

calendarObj : カレンダーオブジェクト
month : 月(実際より1少ない値を指定)

説明

 指定月のカレンダーを表示するにはsetMonth()を使います。setMonth()のパラメータには月を指定します。月は実際よりも1少ない値にします。

サンプルコード [実行]

<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Sample</title>
<link rel="stylesheet" href="main.css" type="text/css" media="all">
<link rel="stylesheet" href="css/calendar.css" type="text/css" media="all">
<script type="text/javascript" src="yahoo.js"></script>
<script type="text/javascript" src="dom.js"></script>
<script type="text/javascript" src="event.js"></script>
<script type="text/javascript" src="calendar.js"></script>
<script type="text/javascript"><!--
window.onload = function(){
var myCalendar = new YAHOO.widget.Calendar("cal", "myCalendar");
myCalendar.setYear(2007);
myCalendar.setMonth(1);
myCalendar.render();
}
// --></script>
</head>
<body>
<h1>指定年月のカレンダーを表示する</h1>
<div id="myCalendar"></div>
</body>
</html>