Object-oriented ASP programming nine---client end functions
Source: Internet
Author: User
// ****************************************************************
<BR>
Script Compont Object model<br>
Design for Dhtml<br>
Copyright 2003 Version 1.0<br>
Made by Yin Dawn <BR>
// ****************************************************************
<BR>
<SCRIPT>
function Isleapyear (syear) {//year parameter error return-1 is a leap years return 1, not a leap-back 0
To get a specific data message from a given date a[0]=year a[1]=month A[2]=day
Date formats can be: year-month-day, year/month/day, year. Month. Day
function DatePart (strdate) {
var adate=new Array
var sdate=new String (strdate)
if (Sdate.search ("-")!=-1) {
Adate=sdate.split ("-")
}
else if (Sdate.search ("/")!=-1) {
Adate=sdate.split ("/")
}
else if (Sdate.search (".")! =-1) {
Adate=sdate.split (".")
}
Return adate
}
The following function determines the legality of a date
function Isrightdate (strdate)
{
var dp=new Array
Dp=datepart (strdate)
Return IsRightDate2 (Dp[0],dp[1],dp[2])
}
function IsRightDate2 (iyear2,imonth2,iday2)
{
var iyear=parseint (IYEAR2)
var imonth=parseint (iMonth2)
var iday=parseint (IDay2)
if (iyear<1900)
return false;
if (imonth<1| | IMONTH>12)
return false;
if (iday<1| | IDAY>31)
return false;
if (imonth==2)
{
if (Isleapyear (iyear))//If it is a leap year
{
if (iday>29)
return false; }
Else
{
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