㈠ 日历代码
万年历代码:
<iframe
src="http://freefilehosting.net/file/?id=pdnxl6re"
width="509"
height=433
marginwidth="0"
marginheight="0"
hspace="0"
vspace="0"
frameborder="0"
scrolling="no"></iframe>
老黄历的源代码:
<IFRAME
style="BORDER-RIGHT:
#000000
1px
dotted;
BORDER-TOP:
#000000
1px
dotted;
BORDER-LEFT:
#000000
1px
dotted;
BORDER-BOTTOM:
#000000
1px
dotted"
border=0
name=nongli
marginHeight=0
src="http://www.nongli.com/todaylhl.htm"
frameBorder=no
width=149
scrolling=no
height=140></IFRAME>
最新日历代码(包括日历、星期、现在时间)
<IFRAME
border=0
name=www1.xise.cn
align=center
marginWidth=0
marginHeight=0
src="http://www1.xise.cn/rili/sj.htm"
frameBorder=0
width=146
scrolling=no
height=183></IFRAME>
代码一:<IFRAME
style="BORDER-RIGHT:
#000000
1px
dotted;
BORDER-TOP:
#000000
1px
dotted;
BORDER-LEFT:
#000000
1px
dotted;
BORDER-BOTTOM:
#000000
1px
dotted"
border=0
name=nongli
marginHeight=0
src="http://www.nongli.com/todaylhl.htm"
frameBorder=no
width=149
scrolling=no
height=140></IFRAME>
代码二:<iframe
name="jiro23"
src="http://astro.sina.com.cn/calendar1.htm"
width="500"
height="500"></iframe>
代码三:<iframe
scrolling=no
height=170
width=165
frameborder=0
marginHeight=0
marginWidth=0
src=http://home.id666.com/user/420009598/disk/webdisk/55.html></iframe>
具体步骤是:复制代码---管理博客-----新增空白面板-----钩选显示源代码(出现钩号,同时文档里出现DIV的字样)----粘贴代码----钩选显示源代码(钩号消失)-----保存新增面板----定制个人首页----选取新增个人面板----保存设置
㈡ 求日历的HTML代码...
这是一段[日历]代码:
<span>
<iframe src='../css_test/rl.asp' width='200' height='170' marginwidth='0' marginheight='0' hspace='0' vspace='0' frameborder='0' scrolling='No'></iframe>
</span>
------
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
Dim currdate,currday,currfirstweek,currDayNum,gridnum,days,monthArr,I
currdate=request.QueryString("date")
If currdate="" then currdate=Date()
currfirstday=FormatdateTime(Year(currdate)&"-"&Month(currdate)&"-01")'格式当前月第一日
currfirstweek=Weekday(currfirstday)-1'获取当前月第一日是星期几
currDayNum=DateDiff("d",currfirstday,DateAdd("m",1,currfirstday))'获取当前月总的天数
gridnum=currfirstweek+currDayNum'获取格子数
If gridnum Mod 7 <>0 Then gridnum=((gridnum\7)+1)*7
monthArr=",一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月"
monthArr=split(monthArr,",")
%>
<table border="1">
<tr>
<td align="center"><a href=""><<</a></td>
<td align="center" colspan="5"><%=monthArr(Month(currdate))%> <%=Year(currdate)%></td>
<td align="center"><a href="">>></a></td>
</tr>
<tr>
<td align="center">日</td>
<td align="center">一</td>
<td align="center">二</td>
<td align="center">三</td>
<td align="center">四</td>
<td align="center">五</td>
<td align="center">六</td>
</tr>
<tr>
<%
For I=1 To gridnum
days=I-currfirstweek
If I>currfirstweek And I<=currfirstweek+currDayNum Then
If days=Day(Now()) And FormatdateTime(Now(),2)=currdate Then
Response.Write("<td align=center bgcolor=""#CCCCCC"">"& days &"</td>")
Else
Response.Write("<td align=center>"& days &"</td>")
End If
Else
Response.Write("<td align=center></td>")
End If
IF I Mod 7 = 0 Then Response.Write("</tr><tr>")
Next
%>
</tr>
</table>
</body>
</html>
㈢ 求论坛日历JS代码
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 8</title>
<script language="javascript">
function calendar(month,year){
var today;
var len = calendar.arguments.length;
if(len == 2){
this.month = calendar.arguments[0];
this.year = calendar.arguments[1];
}
else{
today = new Date();
this.month = today.getMonth();
this.year = today.getYear();
}
this.displayM = displayMonth;
this.displayW = displayWeek;
this.displayD = displayDay;
this.displayY = displayYear;
this.sele1 = select1;
this.sele2 = month1;
}
function displayYear(year){
var ttt;
ttt=document.getElementById("year");
ttt.innerText=year;
}
function displayMonth(month){
var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
var ttt;
var nnn;
ttt=document.getElementById("month");
ttt.innerText=months[month];
}
function displayWeek(month,year)
{
var days = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
var i;
var tablenew;
var trnew;
tablenew = document.getElementById("table1");
trnew = tablenew.insertRow(0);
for(i=0;i<7;i++){
tdnew=trnew.insertCell(i);
tdnew.innerText=days[i];
}
}
function displayDay(month,year){
var days;
var day;
var d;
var todayw;
var table1;
var rows;
var cells;
var i,k,crows,c;
rows=1
// alert(month);
table1 = document.getElementById("table1");
d = new Date(year,month,1);
todayw = d.getDay();
//alert(month);
// alert(todayw);
if(month==0){
days=31;
}
switch (month){
case "0": days=31;
break;
case "1": days=runnian(year);
break;
case "2": days=31;
break;
case "3": days=30;
break;
case "4": days=31;
break;
case "5": days=30;
break;
case "6": days=31;
break;
case "7": days=31;
break;
case "8": days=30;
break;
case "9": days=31;
break;
case "10": days=30;
break;
case "11": days=31;
break;
}
// alert(days);
if(table1.rows.length>=5){
k=table1.rows.length;
k=k-2;
k=k*7;
for(i=0;i<k;i++){
c=i%7;
//alert(c);
table1.rows[rows].cells[c].innerText="";
t=i+1;
c=t%7;
if(c==0){
rows=rows+1;
}
}
for(i=0;i<table1.rows[rows].cells.length;i++){
table1.rows[rows].cells[i].innerText="";
}
if((todayw+days)>(k+table1.rows[rows].cells.length)){
// alert("ttt");
rows=1;
for(i=1;i<=k;i++){
c=(todayw+i-1)%7;
// alert(i);
table1.rows[rows].cells[c].innerText=i;
c=(todayw+i)%7;
if(c==0){
rows=rows+1;
}
}
if(table1.rows[rows].cells.length!=6){
for(j=0;j<table1.rows[rows].cells.length;j++){
table1.rows[rows],cells[j].innerText=i;
i++;
}
trnew=table1.rows[rows];
for(j=k+table1.rows[rows].cells.length+1;j<todayw+days;j++){
c=j%7;
tdnew=trnew.insertCell[c];
tdnew.innerText=j;
c=(j+1)%7;
if((c==0)&&(j!=(todayw+days))){
rows=rows+1;
}
}
}
else{
rows=rows+1;
trnew=table1.insertRow[rows];
for(j=k+table1.rows[rows].cells.length+1;j<=todayw+days;j++){
c=j%7;
tdnew=trnew.insertCell[c];
//alert(j);
tdnew.innerText=j;
c=(j+1)%7;
if((c==0)&&(j!=(todayw+days))){
rows=rows+1;
}
}
}
}
else{
rows=1;
//alert(todayw);
//alert(days);
for(i=todayw;i<todayw+days;i++){
c=i%7;
// alert(i);
table1.rows[rows].cells[c].innerText=i-todayw+1;
c=(i+1)%7;
if(c==0){
rows=rows+1;
}
}
}
}
else{
trnew = table1.insertRow(1)
for(i=0;i<todayw;i++){
trnew.insertCell(i);
}
cells=todayw;
for(i=1;i<=days;i++){
tdnew=trnew.insertCell(cells);
tdnew.innerText=i;
todayw1=todayw+i;
// alert(todayw1);
if(todayw1%7){
cells++;
}
else{
rows=rows+1;
cells=0
var trnew=table1.insertRow(rows);
}
}
}
}
function select1(year){
for(i=1980;i<=2050;i++){
var oOption = document.createElement("OPTION");
oOption.text=i;
oOption.value=i;
if(year==i){
oOption.selected=true;
}
oSelect1 = document.getElementById("yearsel");
oSelect1.add(oOption);
}
}
function month1(month){
for(i=0;i<12;i++){
var oOption = document.createElement("OPTION");
oOption.text=i+1;
oOption.value=i;
if(month==i){
oOption.selected=true;
}
oSelect1 = document.getElementById("monthsel");
oSelect1.add(oOption);
}
}
function runnian(year){
var year1,year2;
year1 = year%100;
year2 = year%4;
if(year1==0){
if(year2==0)
return 29;
else
return 28;
}
else{
if(year2==0)
return 29;
else
return 28;
}
}
function init(){
cal = new calendar();
cal.displayM(cal.month);
cal.displayW();
cal.displayY(cal.year);
cal.displayD(cal.month,cal.year);
cal.sele1(cal.year);
cal.sele2(cal.month);
// delete(cal);
}
function yearchange(){
getyear = document.getElementById("yearsel");
getmonth = document.getElementById("monthsel");
for(i=0;i<getyear.options.length;i++){
if(getyear.options[i].selected==1){
theyear = getyear.options[i].value;
}
}
for(i=0;i<getmonth.options.length;i++){
if(getmonth.options[i].selected==1){
themonth = getmonth.options[i].value;
}
}
cal = new calendar(themonth,theyear);
cal.displayY(cal.year);
cal.displayM(cal.month);
cal.displayD(themonth,cal.year);
}
</script>
</head>
<body onload="init()">
<span id=month></span><span id=year></span>
<table id=table1>
</table>
<SELECT ID="yearsel" onchange="yearchange()">
</SELECT>
<select id="monthsel" onchange="yearchange()">
</select>
</body>
</html>
㈣ 求用C++日历源代码
那更简单,改好了
#include <stdio.h>
#include<conio.h>
#include<stdlib.h>
int IsLeapYear(int);
void main()
{
int i;
int day;
int year;
int month;
int temp;
int temp_i;
long int Year_days = 0;
int Year_Start = 1;
int Per_Year_Days;
int month_day[]={31,28,31,30,31,30,31,31,30,31,30,31,29};
printf("Please enter the year: ");
scanf("%d",&year);
//printf("Please enter the month, enter 0 for the whole year: ");
//scanf("%d",&month);
month=0;
while(Year_Start < year)
{
if( IsLeapYear( Year_Start ) )
Per_Year_Days = 366;
else
Per_Year_Days = 365;
Year_days = Year_days + Per_Year_Days;
Year_Start++;
}
for( temp = 1; temp <=12 && (month*(temp-1)==0); temp++ )
{
if (month!=0) temp=month;
switch(temp)
{
case 1:
printf(" January(%d)\n",year);
break;
case 2:
printf(" February(%d)\n",year);
break;
case 3:
printf(" March(%d)\n",year);
break;
case 4:
printf(" April(%d)\n",year);
break;
case 5:
printf(" May(%d)\n",year);
break;
case 6:
printf(" June(%d)\n",year);
break;
case 7:
printf(" July(%d)\n",year);
break;
case 8:
printf(" August(%d)\n",year);
break;
case 9:
printf(" September(%d)\n",year);
break;
case 10:
printf(" October(%d)\n",year);
break;
case 11:
printf(" November(%d)\n",year);
break;
case 12:
printf(" December(%d)\n",year);
break;
}
i = Year_days % 7;
printf(" Mon Tue Wed Thu Fri Sat Sun\n");
if( i != 0 )
for( temp_i = 0; temp_i < i*4; temp_i++)
printf(" ");
day = 1;
if( IsLeapYear(year) && temp == 2)
while( day <= month_day[12] )
{
if( day >1 )
if( Year_days % 7 == 0 )
printf("\n");
if( day >= 10 )
printf("%4d",day);
else
printf("%4d",day);
Year_days++;
day++;
}
else
while (day <= month_day[temp-1])
{
if( day > 1 )
if( Year_days % 7 == 0 )
printf("\n");
if( day >=10 )
printf("%4d",day);
else
printf("%4d",day);
Year_days++;
day++;
}
printf("\n");
if( getch() == 'q' )
exit(0);
}
getch();
}
int IsLeapYear( int year )
{
if ((year %4 == 0) && (year % 100 != 0) ||
(year % 400 == 0) )
return 1;
else
return 0;
}
㈤ 日历表制作的源代码
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>一个很漂亮实用的日历</title>
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
//创建一个数组,用于存放每个月的天数
function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11)
{
this[0] = m0;
this[1] = m1;
this[2] = m2;
this[3] = m3;
this[4] = m4;
this[5] = m5;
this[6] = m6;
this[7] = m7;
this[8] = m8;
this[9] = m9;
this[10] = m10;
this[11] = m11;
}
//实现月历
function calendar() {
var monthNames = "";
var today = new Date();
var thisDay;
var monthDays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
year = today.getYear() +1900;
thisDay = today.getDate();
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) monthDays[1] = 29;
nDays = monthDays[today.getMonth()];
firstDay = today;
firstDay.setDate(1);
testMe = firstDay.getDate();
if (testMe == 2) firstDay.setDate(0);
startDay = firstDay.getDay();
document.write("<div id='rili' style='position:absolute;width:140px;left:300px;top:100px;'>")
document.write("<TABLE width='217' BORDER='0' CELLSPACING='0' CELLPADDING='2' BGCOLOR='#0080FF'>")
document.write("<TR><TD><table border='0' cellspacing='1' cellpadding='2' bgcolor='Silver'>");
document.write("<TR><th colspan='7' bgcolor='#C8E3FF'>");
var dayNames = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六");
var monthNames = new Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var now = new Date();
document.writeln("<FONT STYLE='font-size:9pt;Color:#330099'>" + "公元 " + now.getYear() + "年" + monthNames[now.getMonth()] + " " + now.getDate() + "日 " + dayNames[now.getDay()] + "</FONT>");
document.writeln("</TH></TR><TR><TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>日</FONT></TH>");
document.writeln("<th bgcolor='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>一</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>二</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>三</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>四</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>五</FONT></TH>");
document.writeln("<TH BGCOLOR='#0080FF'><FONT STYLE='font-size:9pt;Color:White'>六</FONT></TH>");
document.writeln("</TR><TR>");
column = 0;
for (i=0; i<startDay; i++) {
document.writeln("\n<TD><FONT STYLE='font-size:9pt'> </FONT></TD>");
column++;
}
for (i=1; i<=nDays; i++) {
if (i == thisDay) {
document.writeln("</TD><TD ALIGN='CENTER' BGCOLOR='#FF8040'><FONT STYLE='font-size:9pt;Color:#ffffff'><B>")
}
else {
document.writeln("</TD><TD BGCOLOR='#FFFFFF' ALIGN='CENTER'><FONT STYLE='font-size:9pt;font-family:Arial;font-weight:bold;Color:#330066'>");
}
document.writeln(i);
if (i == thisDay) document.writeln("</FONT></TD>")
column++;
if (column == 7) {
document.writeln("<TR>");
column = 0;
}
}
document.writeln("<TR><TD COLSPAN='7' ALIGN='CENTER' VALIGN='TOP' BGCOLOR='#0080FF'>")
document.writeln("<FORM NAME='clock' onSubmit='0'><FONT STYLE='font-size:9pt;Color:#ffffff'>")
document.writeln("现在时间:<INPUT TYPE='Text' NAME='face' ALIGN='TOP'></FONT></FORM></TD></TR></TABLE>")
document.writeln("</TD></TR></TABLE></div>");
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;}
//显示当前时间
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = " " + ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ":0" : ":") + minutes
timeValue += ((seconds < 10) ? ":0" : ":") + seconds
timeValue += (hours >= 12) ? " 下午 " : " 上午 "
document.clock.face.value = timeValue;
timerID = setTimeout("showtime()",1000);//设置超时,使时间动态显示
timerRunning = true;}
function startclock () {
stopclock();
showtime();}
</SCRIPT>
</head>
<body onLoad="startclock(); timerONE=window.setTimeout">
<script language="JavaScript" type="text/javascript">
<!--
calendar();
//-->
</script>
</body>
</html>
㈥ 求Java 日历的小程序的源代码
当在一段代码块定义一个变量时,Java就在栈中 为这个变量分配内存空间,当该变量退出该作用域后,Java会自动释放掉为该变量所分配的内存空间,该内存空间可以立即被另作他用。
Java内存分配中的堆
堆内存用来存放由new创建的对象和数组。 在堆中分配的内存,由Java虚拟机的自动垃圾回收器来管理。
㈦ 求C语言编日历源代码的详细说明
/*
稍微改了下对齐格式,加了注释
*/
/*
1、闰年的算法:
如果某年能被4整除但不能被100整除,
或者能被400整除,
则该年是闰年.
用表达式表示就是
(year
%4
==
0
&&
year%100
!=
0)
||
(year%400
==
0)
2、计算某一天是星期几:
已知1900年的1月1号为星期一,
然后就可以用某一天和1900年的1月1号相差的天数对7取余来求星期,
本题是用的公元1年的1月1号作为基准
*/
#include
<stdio.h>
#include<conio.h>
#include<stdlib.h>
int
IsLeapYear(int);
//函数定义
void
main()
{
int
i;
int
day;
int
year;
int
temp;
int
temp_i;
long
int
Year_days
=
0;
int
Year_Start
=
1;
int
Per_Year_Days;
int
month_day[]={31,28,31,30,31,30,31,31,30,31,30,31,29};
printf("Please
enter
the
year:
");
scanf("%d",&year);
//输入年份
while(Year_Start
<
year)
//从公元1年开始执行while循环,
该年的一月一号为星期一
{
if(
IsLeapYear(
Year_Start
)
)
Per_Year_Days
=
366;
//如果是闰年,
则一年有366天
else
Per_Year_Days
=
365;
//如果不是闰年,
则一年有365天
Year_days
=
Year_days
+
Per_Year_Days;
//Year_days为从公元1年到输入年份的前一年的天数的总和
Year_Start++;
}
for(
temp
=
1;
temp
<=12;
temp++
)
//temp从1到12,
对应一年内12个月
{
switch(
temp
)
//用switch语句将temp和12个月对应起来
{
case
1:
printf("
January(%d)\n",year);
//一月
break;
case
2:
printf("
February(%d)\n",year);
//二月
break;
case
3:
printf("
March(%d)\n",year);
//三月
break;
case
4:
printf("
April(%d)\n",year);
//四月
break;
case
5:
printf("
May(%d)\n",year);
//五月
break;
case
6:
printf("
June(%d)\n",year);
//六月
break;
case
7:
printf("
July(%d)\n",year);
//七月
break;
case
8:
printf("
August(%d)\n",year);
//八月
break;
case
9:
printf("
September(%d)\n",year);
//九月
break;
case
10:
printf("
October(%d)\n",year);
//十月
break;
case
11:
printf("
November(%d)\n",year);
//十一月
break;
case
12:
printf("
December(%d)\n",year);
//十二月
break;
}
i
=
Year_days
%
7;
//每个星期有7天,
故用每年的天数对7取余
printf("Mon\tTue\tWed\tThu\tFri\tSat\tSun\n");
if(
i
!=
0
)
//如果余数不为零
for(
temp_i
=
0;
temp_i
<
i;
temp_i++)
printf("\t");
//则打印空格(这里用\t代替空格,
更加美观),
空格数为i
day
=
1;
//初始化day为1,
为下面的while循环做准备
if(
IsLeapYear(year)
&&
temp
==
2)
//如果输入的年份是闰年,
并且月份为2
while(
day
<=
month_day[12]
)
//day为一循环变量,
取值为1-365(闰年的话为1-366)
{
if(
day
>1
)
//如果天数大于一
if(
Year_days
%
7
==
0
)
//如果是星期日,
则换行
printf("\n");
if(
day
>=
10
)
printf("%d\t",day);
//打印天数+空格
else
printf("%d\t",day);
Year_days++;
day++;
}
else
//如果不满足"输入的年份是闰年,
并且月份为2"
while
(day
<=
month_day[temp-1])
{
if(
day
>
1
)
if(
Year_days
%
7
==
0
)
printf("\n");
if(
day
>=10
)
printf("%d\t",day);
else
printf("%d\t",day);
Year_days++;
day++;
}
printf("\n");
if(
getch()
==
'q'
)
//如果输入为q,
则退出程序
exit(0);
}
getch();
//每按一次键,
打印一个月份
}
int
IsLeapYear(
int
year
)
{
//判断是否是闰年,
是则返回1,
否则返回0
if
((year
%4
==
0)
&&
(year
%
100
!=
0)
||
(year
%
400
==
0)
)
return
1;
else
return
0;
}
㈧ JS日历代码求助
不需要看js和css。只需要修改下面就可以了:
<inputid="selectdate"type="text"style="border:1pxsolid#999;"onClick="fPopCalendar(event,this,this)"onFocus="this.select()"/>
把上面的修改为:
<inputid="selectdate"type="text"style="border:1pxsolid#999;"onFocus="this.select()"/>
<inputtype="button"value="日期选择"onClick="fPopCalendar(event,document.getElementById('selectdate'),document.getElementById('selectdate'))"
就是在文本框后面加一个按钮,然后把文本框的点击事件放到按钮上来。
需要注意的是点击事件onClick="fPopCalendar(event,this,this)"里面的两个this,第一个this你可以不修改,它只是计算位置的,我把这两个this都换成了document.getElementById('selectdate'),单引号里是日期框的id值。这样修改后一个页面里每个日期输入框的id必须是唯一的,例如两个日期框是这样:
<inputid="selectdate"type="text"style="border:1pxsolid#999;"onFocus="this.select()"/>
<inputtype="button"value="日期选择"onClick="fPopCalendar(event,document.getElementById('selectdate'),document.getElementById('selectdate'))"
<inputid="selectdate2"type="text"style="border:1pxsolid#999;"onFocus="this.select()"/>
<inputtype="button"value="日期选择"onClick="fPopCalendar(event,document.getElementById('selectdate2'),document.getElementById('selectdate2'))"
再说一句,按钮太丑了,换个图片多好,我们项目是这样的
㈨ 请问您有日历日程,日程添加到数据库的源代码吗
我想你的问题可能是如何将日期格式的数据存储到数据库,
我可以给你一个思路:
日历日程一般的表达方式:
起始日期1、结束日期1,事件内容1...;
起始日期2、结束日期2,事件内容2...;
... ...
一般日期表达方式有:字符串、长整数、日期时间格式
具体的数据库操作就是用一条sql语句添加一条数据记录,可以多次添加,也可以一次添加多条。
添加记录的SQL语句为insert.语法大同小异。
使用不同的编程语言,源代码的差别很大
㈩ 日历效果的网页代码要怎么做
网上找的:
<!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>
<title>博客专用的JS日历控件</title>
<meta http-equiv="content-type" content="text/html;charset=gb2312">
<style type="text/css">
.Calendar {
font-family:Verdana;
font-size:9pt;
background-color:#EEE;
text-align:center;
width:198px;
height:158px;
padding:10px;
line-height:1.5em;
}
.Calendar a{
color:#0066CC;
}
.Calendar table{
width:100%;
border:0;
}
.Calendar table thead{color:#acacac;}
.Calendar table td {
font-size: 11px;
padding:1px;
}
#idCalendarPre{
cursor:pointer;
float:left;
padding-right:5px;
}
#idCalendarNext{
cursor:pointer;
float:right;
padding-right:5px;
}
#idCalendar td.onToday {
font-weight:bold;
color:#C60;
}
#idCalendar td.onSelect {
font-weight:bold;
}
</style>
<script type="text/javascript">
var $ = function (id) {
return "string" == typeof id ? document.getElementById(id) : id;
};
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
Object.extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
}
var Calendar = Class.create();
Calendar.prototype = {
initialize: function(container, options) {
this.Container = $(container);//table结构容器
this.Days = [];//日期列表
this.SetOptions(options);
this.Year = this.options.Year;
this.Month = this.options.Month;
this.SelectDay = this.options.SelectDay ? new Date(this.options.SelectDay) : null;
this.onSelectDay = this.options.onSelectDay;
this.onToday = this.options.onToday;
this.onFinish = this.options.onFinish;
this.Draw();
},
SetOptions: function(options) {
this.options = {//默认值
Year: new Date().getFullYear(),
Month: new Date().getMonth() + 1,
SelectDay: null,//选择日期
onSelectDay: function(){},
onToday: function(){},
onFinish: function(){}
};
Object.extend(this.options, options || {});
},
//上月
PreMonth: function() {
//取得上月日期对象
var d = new Date(this.Year, this.Month - 2, 1);
//设置属性
this.Year = d.getFullYear();
this.Month = d.getMonth() + 1;
//重绘日历
this.Draw();
},
//下一个月
NextMonth: function() {
var d = new Date(this.Year, this.Month, 1);
this.Year = d.getFullYear();
this.Month = d.getMonth() + 1;
this.Draw();
},
Draw: function() {
//保存日期列表
var arr = [];
//用当月第一天在一周中的日期值作为当月离第一天的天数
for(var i = 1, firstDay = new Date(this.Year, this.Month - 1, 1).getDay(); i <= firstDay; i++){ arr.push(" "); }
//用当月最后一天在一个月中的日期值作为当月的天数
for(var i = 1, monthDay = new Date(this.Year, this.Month, 0).getDate(); i <= monthDay; i++){ arr.push(i); }
// /
var frag = document.createDocumentFragment();
this.Days = [];
while(arr.length > 0){
//每个星期插入一个tr
var row = document.createElement("tr");
//星期
for(var i = 1; i <= 7; i++){
var cell = document.createElement("td");
cell.innerHTML = " ";
if(arr.length > 0){
var d = arr.shift();
cell.innerHTML = d;
if(d > 0){
this.Days[d] = cell;
//获取今日
if(this.IsSame(new Date(this.Year, this.Month - 1, d), new Date())){ this.onToday(cell); }
//判断用户是否作了选择
if(this.SelectDay && this.IsSame(new Date(this.Year, this.Month - 1, d), this.SelectDay)){ this.onSelectDay(cell); }
}
}
row.appendChild(cell);
}
frag.appendChild(row);
}
//此先清空然后再插入(ie的table不能用innerHTML)
while(this.Container.hasChildNodes()){ this.Container.removeChild(this.Container.firstChild); }
this.Container.appendChild(frag);
this.onFinish();
},
//判断是否同一日
IsSame: function(d1, d2) {
return (d1.getFullYear() == d2.getFullYear() && d1.getMonth() == d2.getMonth() && d1.getDate() == d2.getDate());
}
};
</script>
</head>
<body>
<div class="Calendar">
<div id="idCalendarPre"><<</div>
<div id="idCalendarNext">>></div>
<span id="idCalendarYear">2008</span>年 <span id="idCalendarMonth">8</span>月
<table cellspacing="0">
<thead>
<tr>
<td>日</td>
<td>一</td>
<td>二</td>
<td>三</td>
<td>四</td>
<td>五</td>
<td>六</td>
</tr>
</thead>
<tbody id="idCalendar">
</tbody>
</table>
</div>
<script language="JavaScript">
var cale = new Calendar("idCalendar", {
SelectDay: new Date().setDate(10),
onSelectDay: function(o){ o.className = "onSelect"; },
onToday: function(o){ o.className = "onToday"; },
onFinish: function(){
$("idCalendarYear").innerHTML = this.Year; $("idCalendarMonth").innerHTML = this.Month;
var flag = [10,15,20];
for(var i = 0, len = flag.length; i < len; i++){
this.Days[flag[i]].innerHTML = "<a href='javascript:void(0);' onclick=\"alert('您选择的日期是:"+this.Year+"/"+this.Month+"/"+flag[i]+"');return false;\">" + flag[i] + "</a>";
}
}
});
$("idCalendarPre").onclick = function(){ cale.PreMonth(); }
$("idCalendarNext").onclick = function(){ cale.NextMonth(); }
</script>
</body>
</html>