A pure script-written date control

Source: Internet
Author: User
Scripts | controls | scripting | Controls use an IMG as a button, an iframe loading date page


<iframe class= "dtpMonth1" id= "lstDate1" style= "Display:none"; z-index:105; left:112px; width:176px; Position:absolute; top:152px; height:160px "
tabindex= "-1" name= "lstDate1" src= "frmdate.aspx" frameborder= "0" scrolling= "no" >
</IFRAME>

<%@ Page language= "vb" autoeventwireup= "false" codebehind= "FrmDate.aspx.vb" inherits= "Most_web.frmdate"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<HTML>
<HEAD>
<title>dtpDate1</title>
<meta http-equiv= "Content-type" content= "text/html; Charset=shift_jis ">
<meta content= "Microsoft Visual Studio. NET 7.0" name= "Generator" >
<meta content= "Visual Basic 7.0" name= "Code_language" >
<meta content= "JavaScript" name= "vs_defaultClientScript" >
<meta content= "http://schemas.microsoft.com/intellisense/ie5" name= "Vs_targetschema" >
<link href= "Styles.css" type= "Text/css" rel= "stylesheet" >
<script language= "javascript" src= "Comfuncs.js" ></script>
<script language= "JavaScript" >
function Runnian (the_year)//whether to make profit year
{
if ((the_year%400==0) | | ((the_year%4==0) && (the_year%100!=0))
return true;
Else
return false;
}

function Getweekday (the_year,the_month)
{

var Allday;
Allday = 0;
if (the_year>2000)
{
For (i=2000;i<the_year; i++)//Calculate the number of days from 2000 to this year
{
if (Runnian (i)) {
Allday + 366;
}else{
Allday + 365;
}
}

for (i=2; i<=the_month; i++)
{
Switch (i)
{
Case 2:allday + + 31; Break
Case 3:
if (Runnian (the_year)) {
Allday + 29;
}else{
Allday + 28;
}
Break
Case 4:allday + + 31; Break
Case 5:allday + + 30; Break
Case 6:allday + + 31; Break
Case 7:allday + + 30; Break
Case 8:allday + + 31; Break
Case 9:allday + + 31; Break
Case 10:allday + + 30; Break
Case 11:allday + + 31; Break
Case 12:allday + + 30; Break
}
}
}
Return (allday+6)%7;
}

function Chooseday (objname,the_year,the_month,the_day)
{
var FirstDay;
FirstDay = Getweekday (the_year,the_month);
Showcalender (Objname,the_year,the_month,the_day);
}

function Showdate (objname,the_year,the_month,the_day) {//display date, which will be displayed in the textbox with the selected date
var txtdate;
Objname= "Txtdate";
Txtdate= objname;

var completely_date;
var cur_month
var cur_day
if (the_month.tostring (). length==1) {//give the front of the month plus 0
Cur_month= "0" +the_month
}else{
Cur_month=the_month
}
if (the_day.tostring (). length==1) {//giving date plus 0
cur_day= "0" +the_day
}else{
Cur_day=the_day
}
if (the_day!=0)/To adjust the style of the day
Completely_date = The_year + "/" + Cur_month + "/" + cur_day;
Else
Completely_date = "No Choose";

Parent.document.all (txtdate). innertext = completely_date;//shown to textbox
}

function Nextmonth (objname,the_year,the_month,the_day)//select next month
{
if (the_month==12)
Chooseday (Objname,the_year+1,1,the_day);
Else
Chooseday (Objname,the_year,the_month+1,the_day);
}

function Prevmonth (objname,the_year,the_month,the_day)/select last month
{
if (the_month==1)
Chooseday (Objname,the_year-1,12,the_day);
Else
Chooseday (Objname,the_year,the_month-1,the_day);
}
function Closeself () {
Top.document.frames (1). Document.frames (1). Objlostfocus ();
}



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.