万年历源码php(万年历程序代码)
本文目录一览:
php万年历程序代码
PHP代码:
--------------------------------------------------------------------------------
style
.calendar
{
background-color: #FFFFFF;
border: 1px solid #003366;
}
.calendar .title
{
background-image: url("/theme/monthbg.gif");
line-height: 17pt;
background-color: #D8E2EC;
text-align: center;
vertical-align: middle;
font-family: Geneva, Verdana, Arial, sans-serif;
font-size: 13px;
font-weight: Bold;
color: #252216;
}
.calendar .head
{
background-image: url("dayBg.gif");
font-family: Geneva, Verdana, Arial, sans-serif;
font-size: 10px;
font-weight: Bold;
color: #433D27;
}
.calendar tbody
{
line-height: 11pt;
background-color: #F5F4D3;
text-align: center;
vertical-align: middle;
}
.calendar td
{
font-family: Geneva, Verdana, Arial, sans-serif;
font-size: 10px;
line-height: 15pt;
text-align: center;
vertical-align: middle;
width: 25px;
}
.calendar .weekday
{
background-color: #e0e0e0;
}
.calendar .weekend
{
background-color: #d0d0d0;
}
.calendar .today
{
background-color: #f7bebd;
}
.calendar .exmonth
{
background-color: #eeeeee;
}
.calendar a
{
text-decoration: none;
cursor: hand;
}
/style
?php
// 显示某天所在月份的日历
function calendar($time)
{
$start=mktime(0, 0, 0, date('m', $time), 1, date('Y', $time));
$start=$start-date('w', $start)*86400; // extent to start of week
$end=mktime(0, 0, 0, date('m', $time)+1, 1, date('Y', $time));
$end=$end+(7-date('w', $end))*86400; // extent to end of week
//$sWeekday=array('日','一','二','三','四','五','六');
$sWeekday=array('S','M','T','W','T','F','S');
$title=date('M Y', $time);
$prev=mktime(0, 0, 0, date('m', $time)-1, 1, date('Y', $time));
$next=mktime(0, 0, 0, date('m', $time)+1, 1, date('Y', $time));
$url=$_SERVER['PHP_SELF'].'?time=';
$str = '';
$str .= END
table class="c4db-266b-8186-7635 calendar" cellspacing="1"
tr class="266b-8186-7635-a511 title"
th colspan="2"a href="{$url}{$prev}"/a/th
th colspan="3"{$title}/td
th colspan="2"a href="{$url}{$next}"/a/th
/tr
tr class="8186-7635-a511-008d head"
th{$sWeekday[0]}/td
th{$sWeekday[1]}/td
th{$sWeekday[2]}/td
th{$sWeekday[3]}/td
th{$sWeekday[4]}/td
th{$sWeekday[5]}/td
th{$sWeekday[6]}/td
/tr
tr
END;
for($stamp=$start;$stamp$end;$stamp+=86400) // loop through each day, which is 86400 seconds
{
$weekday=date('w', $stamp);
if(date('m', $stamp)!=date('m', $time)) $style='exmonth';
else if(date('Y-m-d', $stamp)==date('Y-m-d')) $style='today';
else if(date('w', $stamp)==0 || date('w', $stamp)==6) $style='weekend';
else $style='weekday';
$str.= "\t\t".'td class="7635-a511-008d-6500 '.$style.'"a href="'.$url.$stamp.'"'.sprintf('%d',date('d', $stamp)).'/a/td'."\n";
if(date('w', $stamp)==6) $str.="\t".'/tr'."\n";
}
$str .= '/table';
return $str;
}
?
php制作一个万年历
一个js文件能做的事为什么要交给PHP通过服务器去做呢?
我表示不理解。
万年历 源码编辑,修改
1.
var adds
if (perscal[2]7)
adds = 1230
else
adds = 1130
var timeData = {
"China 中国": {
"BeiJing 北京":["+"+adds,"","北京、重庆、乌鲁木齐"],//伊朗春节过后修改为+1130,6个月后修改为+1230
"Iran 伊朗":["+0800","","德黑兰"]
}
};
2.在HTML里面加一个div,名字随便了 跟着阴历的一起跑,id=随便取一个名字
然后用document.getElementById("id名").innerHTML="内容" 控制
用php代码做简易的万年历问题
建议;你点击一次刷新一次,当然错误了哦。
连接点击地方是按钮,计算写在函数{}里面。
jq和js都有代码在网上找。