Full calendar use of Asp+javascript

Source: Internet
Author: User
Tags date format return microsoft frontpage
asp+| The first step of the calendar: Save the following file as: Calendar. ASP





<%@ LANGUAGE = VBScript%>


<% Option Explicit%>


<%


Function Sfont (isize,sface,scolor,bscale)


Dim soutputstr


soutputstr = "<font"


if Sface <> "" Then


soutputstr = soutputstr & "face=" & Sface & "'"


Else


soutputstr = soutputstr & "face= ' Helv '"


End If





If isize = "" Then


isize = 1


End If


if Bscale then


isize = cInt (isize * 1)


End If


soutputstr = soutputstr & "size=" & Isize


if Scolor <> "" Then


soutputstr = soutputstr & "color=" & Scolor


End If





soutputstr = soutputstr & ">"





Sfont = Soutputstr


End Function


on Error Resume Next


Dim Datecntrl, Dy, Mo, Yr, Nextmonth, Startwith, Thismo, Thisyr, Thisdate,the_type


Dim prevmonthlastdate, Currmonthlastdate, I, J, Lastnum, Anydate,default_value





datecntrl= Request ("Object")


default_value=request ("value")


the_type=request ("type")


if The_type<> "datetime" then


the_type= "Date"


End If





if default_value= "" then


Yr = year (date)


Mo = month (date)


Dy = Day (date)


Else


Dim pos1


Dim Deal_value


Deal_value=default_value


pos1=instr (Deal_value, "-")


Yr = CInt (Mid (deal_value,1,pos1-1))


Deal_value=mid (deal_value,pos1+1)


pos1=instr (Deal_value, "-")


Mo = CInt (Mid (deal_value,1,pos1-1))


if trim (the_type) = "Date" then


Dy = CInt (Mid (deal_value,pos1+1))


Else


Dim h,m,s


Deal_value=mid (deal_value,pos1+1)


pos1=instr (Deal_value, "")


Dy=cint (Mid (deal_value,1,pos1-1))


Deal_value=mid (deal_value,pos1+1)


pos1=instr (Deal_value, ":")


H=cint (Mid (deal_value,1,pos1-1))


Deal_value=mid (deal_value,pos1+1)


pos1=instr (Deal_value, ":")


M=cint (Mid (deal_value,1,pos1-1))


S=cint (Mid (deal_value,pos1+1))


End If


End If





Nextmonth = False


%>


<HTML>


<HEAD>


<meta http-equiv= "Content-type" content= "text/html"; charset=gb2312 ">


<meta name= "generator" content= "Microsoft FrontPage 4.0" >


<meta name= "ProgId" content= "FrontPage.Editor.Document" >


<style type= "Text/css" >


A


{font-size:13px; COLOR: #000000; Text-decoration:none}


a:hover


{COLOR: #ff0000;


}


</style>


<TITLE> Calendar </TITLE>


<script language= "JavaScript" >


//Check whether the string is a date, return value: false, True


function F_chkdate (DATESTR)


{


var lthdatestr


if (datestr!= "")


lthdatestr= datestr.length;


Else


lthdatestr=0;





var tmpy= "";


var tmpm= "";


var tmpd= "";


//var Datestr;


var status;


status=0;


if (lthdatestr== 0)


return false;





if (lthdatestr>10)


return false;





for (I=0;i < lthdatestr;i++)


{if (Datestr.charat (i) = = '-')


{


status++;


}


if (status>2)


{


//alert ("Invalid format of date!");


return false;


}


if ((status==0) && (Datestr.charat (i)!= '-')


{


Tmpy=tmpy+datestr.charat (i)


}


if ((status==1) && (Datestr.charat (i)!= '-')


{


Tmpm=tmpm+datestr.charat (i)


}


if ((status==2) && (Datestr.charat (i)!= '-')


{


Tmpd=tmpd+datestr.charat (i)


}





}


year=new String (tmpy);


month=new String (TMPM);


day=new String (TMPD);





//tempdate= New String (Year+month+day);


//alert (tempdate);


if ((tmpy.length!=4) | | (tmpm.length>2) | | (TMPD.LENGTH>2))


{


//alert ("Invalid format of date!");


return false;


}


if (!) ( (1<=month) && (12>=month) && (31>=day) && (1<=day))


{


//alert ("Invalid month or day!");


return false;


}


if (!) ( (year% 4) ==0) && (month==2) && (day==29))


{


//alert ("This isn't a leap year!");


return false;


}


if







Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.