21,887
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sample3_1</title>
<script type="text/javascript" src="functions.js"></script>
<link rel="stylesheet" type="text/css" href="style.css"/>
</head>
<body>
<div id="createtask" class="formclass"></div>
<div id="autocompletediv" class="autocomp"></div>
<div id="taskbox" class="taskboxclass"></div>
<p><a href="javascript://" onclick="showHideCalendar()"><img id="opencloseimg" src="images/plus.gif" alt="" title="" style="border:none;width:9px;height:9px;"/></a><a href="javascript://" onclick="showHideCalendar()">My Calendar</a></p>
<div id="calendar" style="width:105px;text-align:left;"></div>
</body>
</html>
// JavaScript Document
//创建一个布尔型变量,用来检查是否为有效的IE实例
var xmlhttp=false;
//检查是否使用IE
try{
//如果Javascript的版本大于5
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
//如果不是,则使用老版本的ActiveX对象
try{
//如果使用的是IE浏览器
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){
//否则肯定使用的是非IE浏览器
xmlhttp=false;
}
}
//如果使用的是非IE浏览器,则创建一个该对象的Javascript实例
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){
xmlhttp = new XMLHttpRequset();
}
//一个用来确定日历是处于打开还是关闭状态的变量
var showCalendar=true;
function showHideCalendar(){
//要载入该页面的位置
var objID = "calendar";
//将当前图像改为加号或是减号
if(showCalendar == true){
//显示日历
document.getElementById("opencloseimg").src="images/mins.gif";
//载入页面
var serverPage="calendar.php";
//设置跟踪开、关的变量
showCalendar = false;
var obj=document.getElementById(objID);
xmlhttp.open("GET",serverPage);
xmlhttp.onreadystatechange=function(){//回调函数
if(xmlhttp.readyState==4 && xmlhttp.status == 200){
obj.innerHTML = xmlhttp.responseText;
}
}
xmlhttp.send(null);
}else{
//隐藏日历
document.getElementById("opencloseimg").src="images/plus.gif";
showCalendar=true;
document.getElementById(objID).innerHTML="";
}
}
<?php
//检查月份值和年份值是否存在
if((!$_GET['month'])&&(!$_GET['year'])){
$month = date("n");
//$month = date("m");
$year = date("y");
}else{
$month = $_GET['month'];
$year = $_GET['year'];
}
//计算所查看的月份
$timestamp = mktime(0,0,0,$month,1,$year);
$monthname = date("F",$timestamp);
//按照月份创建表格
?>
<table style="width:105px;border-collapse:collapse;" border="1" cellpadding="3" cellspacing="0" bordercolor="#000000">
<tr style="background:#FFBC37">
<td colspan="7" style="text-align:center;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<span style="font-weight:bold;"><?php echo $monthname." ".$year;?></span>
</td>
</tr>
<tr style="background:#FFBC37">
<td style="text-align:center;width:15px;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<span style="font-weight:bold;">Su</span>
</td>
<td style="text-align:center;width:15px;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<span style="font-weight:bold;">M</span>
</td>
<td style="text-align:center;width:15px;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<span style="font-weight:bold;">Tu</span>
</td>
<td style="text-align:center;width:15px;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<span style="font-weight:bold;">W</span>
</td>
<td style="text-align:center;width:15px;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<span style="font-weight:bold;">Th</span>
</td>
<td style="text-align:center;width:15px;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<span style="font-weight:bold;">F</span>
</td>
<td style="text-align:center;width:15px;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<span style="font-weight:bold;">Sa</span>
</td>
</tr>
<?php
$monthstart=date("w",$timestamp);
$lastday=date("d",mktime(0,0,0,$month + 1 ,0,$year));
$startdate = -$monthstart;//请问这句话是什么意思?
//计算出所需的行数
$numrows=ceil(((date("t",mktime(0,0,0,$month + 1,0,$year))+$monthstart)/7));
//创建适当的行数……
for($k=1;$k<$numrows;$k++){
?><tr><?php
//使用7列(表示7天)
for($i=0;$i<7;$i++){
$startdate++;
if(($startdate<=0)||($startdate>$lastday)){
//如果在日历中有空白的格子
?><td style="background:#FFFFFF;"> </td><?php
}else{
if($startdate==date("j")&& $month==date("n")&&$year==date("Y")){
?><td style="text-align:center;background:#FFBC37;" onMouseOver="this.style.background='#FECE6E'" onMouseOut="this.style.background='#FFBC37'">
<?php echo date("j");?></td><?php
}else{
?><td style="text-align:center; background:#A2BAFA;" onmouseover="this.style.background='#CAD7F9'" onmouseout="this.style.background='#A2BAFA'">
<?php echo $startdate;?></td><?php
}
}
}
?></tr><?php
}
?>
</table>
//创建适当的行数……
for($k=1;$k<$numrows;$k++){
?><tr><?php
//使用7列(表示7天)
for($i=0;$i<7;$i++){
//创建适当的行数……
for($k=1;$k<=$numrows;$k++){
?><tr><?php
//使用7列(表示7天)
for($i=0;$i<7;$i++){
即可$monthstart=date("w",$timestamp);
$lastday=date("d",mktime(0,0,0,$month + 1 ,0,$year));
$startdate = -$monthstart;
这几句话是什么意思,尤其是最后一句话@charset "utf-8";
/* CSS Document */
body{
font-family:Verdana, Arial, Helvetica;
font-size:11px;
color:#000000;
}
.formclass{
position:absolute;
left:0px;
top:0px;
visibility:hidden;
height:0px;
width:0px;
background:#A2BAFA;
border-style:solid;
border-width:1px;
border-color:#000000;
}
.autocomp{
position:absolute;
left:0px;
top:0px;
visibility:hidden;
width:0px;
}
.taskboxclass{
position:absolute;
left:0px;
top:0px;
visibility:hidden;
width:0px;
}
.calendarover{
text-align:center;
background:#CAD7F9;
width:15px;
}
.calendaroff{
text-align:center;
background:#A2BAFA;
width:15px;
}
.calendartodayover{
text-align:center;
background-color:#FECE6E;
width:15px;
}
.taskchecker{
width:150px;
background-color:#FFBC37;
border-style:solid;
border-color:#000000;
border-width:1px;
}
.tcpadding{
padding:10px;
}
.calendartodayoff{
text-align:center;
background:#FFBC37;
width:15px;
}