<!--#include file="../conn.asp" -->
<%
dim l_year,l_month,l_day,l_time,cat_id
l_year=Request("l_year")
l_month=Request("l_month")
l_day=Request("l_day")
'getsearchcode
'====================================================日历代码
ca_bg_color="#c8ccc8" '日历背景即边线颜色
ca_head_color="#D56324" '头部颜色
ca_week_color="#f0f0f0" '星期栏颜色
ca_day_color="#ffffff" '主背景色
ca_nowday_color="#f0f0f0" '按日查看时所查看日的颜色
ca_today_color="#c8ccc8" '今天的颜色redim linkdays(2,0)
linkcount=0dim ccode
sub calenda(c_year,c_month,c_day)if c_year="" then c_year=year(Now())
if c_month="" then c_month=month(Now())
if c_day="" then c_day=0c_year=cint(c_year)
c_month=cint(c_month)
c_day=cint(c_day)
'===============================================添加连接
'sql="SELECT l_day,l_month,l_year FROM log WHERE l_year="&c_year&" AND l_month="&c_month&" order by l_day"
'set rs_month=conn.EXECUTE(sql)
'dim theday
'theday=0'do while not rs_month.eof
'if rs_month("l_day")<>theday then
'theday=rs_month("l_day")'redim preserve linkdays(2,linkcount)
'linkdays(0,linkcount)=rs_month("l_month")
'linkdays(1,linkcount)=rs_month("l_day")
'linkdays(2,linkcount)="index.asp?vt=byday&l_year="&rs_month("l_year")&"&l_month="&rs_month("l_month")&"&l_day="&rs_month("l_day")
'linkcount=linkcount+1
'end if
'rs_month.MoveNext
'Loop
'set rs_month=nothing
'===================================================dim mname(12)
mname(0)=""
mname(1)="January "
mname(2)="February "
mname(3)="March "
mname(4)="April "
mname(5)="May "
mname(6)="June "
mname(7)="July "
mname(8)="August "
mname(9)="September "
mname(10)="October "
mname(11)="November "
mname(12)="December "dim mdays(12)
mdays(0)=""
mdays(1)=31
mdays(2)=28
mdays(3)=31
mdays(4)=30
mdays(5)=31
mdays(6)=30
mdays(7)=31
mdays(8)=31
mdays(9)=30
mdays(10)=31
mdays(11)=30
mdays(12)=31
'今天的年月日
today=day(Now())
tomonth=month(Now())
toyear=year(Now())'指定的年月日及星期thismonth=c_month
thisdate=c_day
thisyear=c_year
If IsDate("February 29, " & thisyear) Then mdays(2)=29'确定日历1号的星期
startspace=weekday( thismonth&"-1-"&thisyear )-1ccode="<table border='0' width='100%' align='center' cellspacing='1' cellpadding='1' bgcolor='"&ca_bg_color&"' class='caBox'>"ccode=ccode&"<tr><td colspan='7' bgcolor='"&ca_head_color&"' style='color:#ffffff;font-size:9px;font-family:sans-serif'> <b>" &mname(thismonth)& thisyear&"</b></td></tr><tr>"ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Sun</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Mon</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Tue</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Wed</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Thu</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Fri</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Sat</b></td></tr><tr>"for s=0 to startspace-1
ccode=ccode&"<td bgcolor='"&ca_day_color&"'></td>"
nextcount=1
while count<=mdays(thismonth)
for b=startspace to 6
thisbgcolor=ca_day_color
if count=today and thisyear=toyear and thismonth=tomonth then thisbgcolor=ca_today_color
if count=thisdate then thisbgcolor=ca_nowday_color
ccode=ccode&"<td align='center' bgcolor='"&thisbgcolor&"' style='font-size:9px;font-family:sans-serif'>"
linktrue="false"
for c=0 to ubound(linkdays,2)
if linkdays(0,c)<>"" then
if linkdays(0,c)=thismonth and linkdays(1,c)=count then
ccode=ccode&"<a href='"&linkdays(2,c)&"'>"
linktrue="true"
end if
end if
next
if count<=mdays(thismonth) then ccode=ccode&count
if linktrue="true" then ccode=ccode&"</a>"
ccode=ccode&"</td>" count=count+1
next
ccode=ccode&"</tr>"
startspace=0
wend
'ccode=ccode&"</table>"nextmonth=c_month+1
nextyear=c_year
if nextmonth>12 then
nextmonth=1
nextyear=nextyear+1
end if
promonth=c_month-1
proyear=c_year
if promonth<1 then
promonth=12
proyear=proyear-1
end ifccode=ccode&"<tr><td colspan='7' bgcolor='"&ca_week_color&"' align='center'>"
ccode=ccode&"<a href='index.asp?vt=bymonth&l_year="&proyear&"&l_month="&promonth&"'><span class='arrow'>3</span></a><b> MONTH </b><a href='index.asp?vt=bymonth&l_year="&nextyear&"&l_month="&nextmonth&"'><span class='arrow'>4</span></a> <a href='index.asp?vt=byyear&l_year="&l_year-1&"&l_month="&l_month&"'><span class='arrow'>3</span></a><b> YEAR </b><a href='index.asp?vt=byyear&l_year="&l_year+1&"&l_month="&l_month&"'><span class='arrow'>4</span></a>"
ccode=ccode&"</tr></table>"end sub%>
差不多吧
<%
dim l_year,l_month,l_day,l_time,cat_id
l_year=Request("l_year")
l_month=Request("l_month")
l_day=Request("l_day")
'getsearchcode
'====================================================日历代码
ca_bg_color="#c8ccc8" '日历背景即边线颜色
ca_head_color="#D56324" '头部颜色
ca_week_color="#f0f0f0" '星期栏颜色
ca_day_color="#ffffff" '主背景色
ca_nowday_color="#f0f0f0" '按日查看时所查看日的颜色
ca_today_color="#c8ccc8" '今天的颜色redim linkdays(2,0)
linkcount=0dim ccode
sub calenda(c_year,c_month,c_day)if c_year="" then c_year=year(Now())
if c_month="" then c_month=month(Now())
if c_day="" then c_day=0c_year=cint(c_year)
c_month=cint(c_month)
c_day=cint(c_day)
'===============================================添加连接
'sql="SELECT l_day,l_month,l_year FROM log WHERE l_year="&c_year&" AND l_month="&c_month&" order by l_day"
'set rs_month=conn.EXECUTE(sql)
'dim theday
'theday=0'do while not rs_month.eof
'if rs_month("l_day")<>theday then
'theday=rs_month("l_day")'redim preserve linkdays(2,linkcount)
'linkdays(0,linkcount)=rs_month("l_month")
'linkdays(1,linkcount)=rs_month("l_day")
'linkdays(2,linkcount)="index.asp?vt=byday&l_year="&rs_month("l_year")&"&l_month="&rs_month("l_month")&"&l_day="&rs_month("l_day")
'linkcount=linkcount+1
'end if
'rs_month.MoveNext
'Loop
'set rs_month=nothing
'===================================================dim mname(12)
mname(0)=""
mname(1)="January "
mname(2)="February "
mname(3)="March "
mname(4)="April "
mname(5)="May "
mname(6)="June "
mname(7)="July "
mname(8)="August "
mname(9)="September "
mname(10)="October "
mname(11)="November "
mname(12)="December "dim mdays(12)
mdays(0)=""
mdays(1)=31
mdays(2)=28
mdays(3)=31
mdays(4)=30
mdays(5)=31
mdays(6)=30
mdays(7)=31
mdays(8)=31
mdays(9)=30
mdays(10)=31
mdays(11)=30
mdays(12)=31
'今天的年月日
today=day(Now())
tomonth=month(Now())
toyear=year(Now())'指定的年月日及星期thismonth=c_month
thisdate=c_day
thisyear=c_year
If IsDate("February 29, " & thisyear) Then mdays(2)=29'确定日历1号的星期
startspace=weekday( thismonth&"-1-"&thisyear )-1ccode="<table border='0' width='100%' align='center' cellspacing='1' cellpadding='1' bgcolor='"&ca_bg_color&"' class='caBox'>"ccode=ccode&"<tr><td colspan='7' bgcolor='"&ca_head_color&"' style='color:#ffffff;font-size:9px;font-family:sans-serif'> <b>" &mname(thismonth)& thisyear&"</b></td></tr><tr>"ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Sun</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Mon</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Tue</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Wed</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Thu</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Fri</b></td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'><b>Sat</b></td></tr><tr>"for s=0 to startspace-1
ccode=ccode&"<td bgcolor='"&ca_day_color&"'></td>"
nextcount=1
while count<=mdays(thismonth)
for b=startspace to 6
thisbgcolor=ca_day_color
if count=today and thisyear=toyear and thismonth=tomonth then thisbgcolor=ca_today_color
if count=thisdate then thisbgcolor=ca_nowday_color
ccode=ccode&"<td align='center' bgcolor='"&thisbgcolor&"' style='font-size:9px;font-family:sans-serif'>"
linktrue="false"
for c=0 to ubound(linkdays,2)
if linkdays(0,c)<>"" then
if linkdays(0,c)=thismonth and linkdays(1,c)=count then
ccode=ccode&"<a href='"&linkdays(2,c)&"'>"
linktrue="true"
end if
end if
next
if count<=mdays(thismonth) then ccode=ccode&count
if linktrue="true" then ccode=ccode&"</a>"
ccode=ccode&"</td>" count=count+1
next
ccode=ccode&"</tr>"
startspace=0
wend
'ccode=ccode&"</table>"nextmonth=c_month+1
nextyear=c_year
if nextmonth>12 then
nextmonth=1
nextyear=nextyear+1
end if
promonth=c_month-1
proyear=c_year
if promonth<1 then
promonth=12
proyear=proyear-1
end ifccode=ccode&"<tr><td colspan='7' bgcolor='"&ca_week_color&"' align='center'>"
ccode=ccode&"<a href='index.asp?vt=bymonth&l_year="&proyear&"&l_month="&promonth&"'><span class='arrow'>3</span></a><b> MONTH </b><a href='index.asp?vt=bymonth&l_year="&nextyear&"&l_month="&nextmonth&"'><span class='arrow'>4</span></a> <a href='index.asp?vt=byyear&l_year="&l_year-1&"&l_month="&l_month&"'><span class='arrow'>3</span></a><b> YEAR </b><a href='index.asp?vt=byyear&l_year="&l_year+1&"&l_month="&l_month&"'><span class='arrow'>4</span></a>"
ccode=ccode&"</tr></table>"end sub%>
差不多吧
解决方案 »
- caller使用
- JS树"造成该页上的脚本造成Internet Explorer 运行速度减慢.如果继续运行,您的计算机将变的更慢.是否取消该脚本?"问题:高手请进
- 在网页中显示日期
- js页面上对输入值验证
- 一个不是很难的正则表达式!---------在线等!
- 如何让用户只输入英文和数字?
- 如何代码替换?
- 紧急求助,来者有分,为什么我的.htm页面调用外部的.js文件无效,
- 如何实在选择某个下拉框内的条目?
- jquery.easyui.min或是jquery.easyui 中文帮助文档
- 急::在线求..一个JSP页面上的表单用的日期控件!!!!!!(有高分相送) thanks!!!
- 如何使DIV或者table一个一个的显示,并且中间有间隔时间
以后怎么页面什么都没有呀!!
{
var myDate=new Date();
this.year=myDate.getFullYear(); //定义year属性,年份,默认值为当前系统年份。
this.month=myDate.getMonth()+1; //定义month属性,月份,默认值为当前系统月份。
this.date=myDate.getDate(); //定义date属性,日,默认值为当前系统的日。
this.inputName=''; //定义inputName属性,即输入框的name,默认值为空。注意:在同一页中出现多个日期输入框,不能有重复的name!
this.display=display; //定义display方法,用来显示日期输入框。
}function display() //定义dateSelector的display方法,它将实现一个日历形式的日期选择框。
{
var week=new Array('日','一','二','三','四','五','六'); document.write("<style type=text/css>");
document.write(" .ds_font td,span { font: normal 12px 宋体; color: #000000; }");
document.write(" .ds_border { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");
document.write(" .ds_border2 { border: 1px solid #000000; cursor: hand; background-color: #DDDDDD }");
document.write("</style>"); document.write("<input style='text-align:center;width:200px' id='DS_"+this.inputName+"' name='"+this.inputName+"' value='"+this.year+"-"+this.month+"-"+this.date+"' title=双击可进行编缉 ondblclick='this.readOnly=false;this.focus()' onblur='this.readOnly=true' readonly >");
document.write("<button style='width:60px;height:18px;font-size:12px;margin:1px;border:1px solid #A4B3C8;background-color:#E6E6E6;' type=button onclick=this.nextSibling.style.display='block' onfocus=this.blur()>选择日期</button>"); document.write("<div style='position:absolute;display:none;text-align:center;width:0px;height:0px;overflow:visible' onselectstart='return false;'>");
document.write(" <div style='position:absolute;left:-60px;top:20px;width:142px;height:165px;background-color:#F6F6F6;border:1px solid #245B7D;' class=ds_font>");
document.write(" <table cellpadding=0 cellspacing=1 width=140 height=20 bgcolor=#CEDAE7 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>");
document.write(" <tr align=center>");
document.write(" <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subYear(this) title='减小年份'><span style=\"font-family:webdings\">7</span></td>");
document.write(" <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=subMonth(this) title='减小月份'><span style=\"font-family:webdings\">3</span></td>");
document.write(" <td width=52%><b>"+this.year+"</b><b>年</b><b>"+this.month+"</b><b>月</b></td>");
document.write(" <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addMonth(this) title='增加月份'><span style=\"font-family:webdings\">4</span></td>");
document.write(" <td width=12% onmouseover=this.className='ds_border' onmouseout=this.className='' onclick=addYear(this) title='增加年份'><span style=\"font-family:webdings\">8</span></td>");
document.write(" </tr>");
document.write(" </table>"); document.write(" <table cellpadding=0 cellspacing=0 width=140 height=20 onmousedown='DS_x=event.x-parentNode.style.pixelLeft;DS_y=event.y-parentNode.style.pixelTop;setCapture();' onmouseup='releaseCapture();' onmousemove='dsMove(this.parentNode)' style='cursor:move;'>");
document.write(" <tr align=center>");
for(i=0;i<7;i++)
document.write(" <td>"+week[i]+"</td>");
document.write(" </tr>");
document.write(" </table>"); document.write(" <table cellpadding=0 cellspacing=2 width=140 bgcolor=#EEEEEE>");
for(i=0;i<6;i++)
{
document.write(" <tr align=center>");
for(j=0;j<7;j++)
document.write(" <td width=10% height=16 onmouseover=if(this.innerText!=''&&this.className!='ds_border2')this.className='ds_border' onmouseout=if(this.className!='ds_border2')this.className='' onclick=getValue(this,document.all('DS_"+this.inputName+"'))></td>");
document.write(" </tr>");
}
document.write(" </table>"); document.write(" <span style=cursor:hand onclick=this.parentNode.parentNode.style.display='none'>【关闭】</span>");
document.write(" </div>");
document.write("</div>"); dateShow(document.all("DS_"+this.inputName).nextSibling.nextSibling.childNodes[0].childNodes[2],this.year,this.month)
}
{
var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;
myObj[0].innerHTML=eval(myObj[0].innerHTML)-1;
dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))
}function addYear(obj) //增加年份
{
var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;
myObj[0].innerHTML=eval(myObj[0].innerHTML)+1;
dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))
}function subMonth(obj) //减小月份
{
var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;
var month=eval(myObj[2].innerHTML)-1;
if(month==0)
{
month=12;
subYear(obj);
}
myObj[2].innerHTML=month;
dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))
}function addMonth(obj) //增加月份
{
var myObj=obj.parentNode.parentNode.parentNode.cells[2].childNodes;
var month=eval(myObj[2].innerHTML)+1;
if(month==13)
{
month=1;
addYear(obj);
}
myObj[2].innerHTML=month;
dateShow(obj.parentNode.parentNode.parentNode.nextSibling.nextSibling,eval(myObj[0].innerHTML),eval(myObj[2].innerHTML))
}function dateShow(obj,year,month) //显示各月份的日
{
var myDate=new Date(year,month-1,1);
var today=new Date();
var day=myDate.getDay();
var selectDate=obj.parentNode.parentNode.previousSibling.previousSibling.value.split('-');
var length;
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
length=31;
break;
case 4:
case 6:
case 9:
case 11:
length=30;
break;
case 2:
if((year%4==0)&&(year%100!=0)||(year%400==0))
length=29;
else
length=28;
}
for(i=0;i<obj.cells.length;i++)
{
obj.cells[i].innerHTML='';
obj.cells[i].style.color='';
obj.cells[i].className='';
}
for(i=0;i<length;i++)
{
obj.cells[i+day].innerHTML=(i+1);
if(year==today.getFullYear()&&(month-1)==today.getMonth()&&(i+1)==today.getDate())
obj.cells[i+day].style.color='red';
if(year==eval(selectDate[0])&&month==eval(selectDate[1])&&(i+1)==eval(selectDate[2]))
obj.cells[i+day].className='ds_border2';
}
}function getValue(obj,inputObj) //把选择的日期传给输入框
{
var myObj=inputObj.nextSibling.nextSibling.childNodes[0].childNodes[0].cells[2].childNodes;
if(obj.innerHTML)
inputObj.value=myObj[0].innerHTML+"-"+myObj[2].innerHTML+"-"+obj.innerHTML;
inputObj.nextSibling.nextSibling.style.display='none';
for(i=0;i<obj.parentNode.parentNode.parentNode.cells.length;i++)
obj.parentNode.parentNode.parentNode.cells[i].className='';
obj.className='ds_border2'
}function dsMove(obj) //实现层的拖移
{
if(event.button==1)
{
var X=obj.clientLeft;
var Y=obj.clientTop;
obj.style.pixelLeft=X+(event.x-DS_x);
obj.style.pixelTop=Y+(event.y-DS_y);
}
}
//调用
<script language=javascript>
var myDate=new dateSelector();
myDate.year = "年";
myDate.month = "月.";
myDate.date = "日.";
myDate.inputName='start_date';
myDate.display();
</script>
http://www.dev-club.com/upload-files/essence/2171561.RAR