![](https://csdnimg.cn/release/download_crawler_static/3031615/bg4.jpg)
56 第5 章 表 单
returnfalse;"/>
<divalign="right"><ahref="javascript:closetask()">close</a></div>
</form>
</div>
代码清单52 显示日历的代码(calendar.php)
<?php
//calendar.php
//检查月份和年份值是否存在。
if(!$_GET['month']&&!$_GET['year']){
$month=date("n");
$year=date("Y");
}else{
$month=max(1,min(12,$_GET['month']));
$year=max(1900,min(2050,$_GET['year']));
}
//计算将查看的月份信息。
$timestamp=mktime(0,0,0,$month,1,$year);
$monthname=date("F",$timestamp);
//Nowlet'screatethetablewiththepropermonth.
?>
<tablestyle="width:105px;bordercollapse:collapse;"border="1"
cellpadding="3"cellspacing="0"bordercolor="#000000">
<trstyle="background:#FFBC37;">
<tdcolspan="7"style="textalign:center;"
onmouseover="this.style.background=#FECE6E'"
onmouseout="this.style.background='#FFBC37'">
<spanstyle="fontweight:bold;"><?phpecho$monthname."".$year;?></span>
</td>
</tr>
<trstyle="background:#FFBC37;">
<tdstyle="textalign:center;width:15px;"
onmouseover="this.style.background='#FECE6E'"
onmouseout="this.style.background='#FFBC37'">
<spanstyle="fontweight:bold;">Su</span>
</td>
<tdstyle="textalign:center;width:15px;"
onmouseover="this.style.background='#FECE6E'"
onmouseout="this.style.background='#FFBC37'">
<spanstyle="fontweight:bold;">M</span>