Play with the calendar control (with many nice styles)

Source: Internet
Author: User

Index.html for style change,
Select the following style.
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/theme.css" Title = "Aqua"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-blue.css" Title = "Winter"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-blue2.css" Title = "blue"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-brown.css" Title = "Summer"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-green.css" Title = "green"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-win2k-1.css" Title = "win2k-1"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-win2k-2.css" Title = "win2k-2"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-win2k-cold-1.css" Title = "win2k-cold-1"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-win2k-cold-2.css" Title = "win2k-cold-2"/>
<LINK rel = "stylesheet" type = "text/CSS" href = "CSS/calendar-system.css" Title = "system"/>
Complete index.html code
<? XML version = "1.0" encoding = "UTF-8"?>
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 strict // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/XML; charset = UTF-8"/>
<Title> the coolest DHTML calendar-Online Demo </title>
<LINK rel = "stylesheet" type = "text/CSS" Media = "all" href = "CSS/theme.css" _ fcksavedurl = "" CSS/theme.css "" Title = "Aqua "/>
<SCRIPT type = "text/JavaScript" src = "JS/calendar. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript" src = "JS/lang/cn_utf8.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">

Function selected (CAL, date ){
Cal. Sel. value = date; // just update the date in the input field.
If (Cal. dateclicked & (Cal. Sel. ID = "sel1" | Cal. Sel. ID = "sel3 "))
Cal. callclosehandler ();
}

Function closehandler (CAL ){
Cal. Hide (); // hide the calendar

_ Dynarch_popupcalendar = NULL;
}
Function showcalendar (ID, format, showstime, showsothermonths ){
VaR El = Document. getelementbyid (ID );
If (_ dynarch_popupcalendar! = NULL ){
_ Dynarch_popupcalendar.hide (); // so we hide it first.
} Else {
VaR Cal = New Calendar (1, null, selected, closehandler );
If (typeof showstime = "string "){
Cal. showstime = true;
Cal. time24 = (showstime = "24 ");
}
If (showsothermonths ){
Cal. showsothermonths = true;
}
_ Dynarch_popupcalendar = Cal; // remember it in the global VaR
Cal. setrange (1900,207 0); // min/MAX year allowed.
Cal. Create ();
}
_ Dynarch_popupcalendar.setdateformat (format); // set the specified date format
_ Dynarch_popupcalendar.parsedate (El. Value); // try to parse the text in Field
_ Dynarch_popupcalendar.sel = El; // inform it What input field we use

_ Dynarch_popupcalendar.showatelement (El. nextsibling, "Br"); // show the calendar

Return false;
}

VaR minute = 60*1000;
VaR hour = 60 * minute;
VaR day = 24 * hour;
VaR week = 7 * day;

Function isdisabled (date ){
VaR today = new date ();
Return (math. Abs (date. gettime ()-Today. gettime ()/day)> 10;
}

Function flatselected (CAL, date ){
VaR El = Document. getelementbyid ("preview ");
El. innerhtml = date;
}

</SCRIPT>
</Head>
<Body>
<Br/>
</P>
<Form action = "#">
<Br/>
<B> date #1: </B> <input type = "text" name = "date1" id = "sel1" size = "30"
> <Input type = "reset" value = "..."
Onclick = "Return showcalendar ('sel1', '% Y-% m-% d [% W] % H: % m', '24', true ); "> % Y-% m-% d [% W] % H: % m -- single
Click <br/>

<B> date #2: </B> <input type = "text" name = "date2" id = "sel2" size = "30"
> <Input type = "reset" value = "..."
Onclick = "Return showcalendar ('sel2', '% A, % B % E, % Y [% I: % m % P]', '12 '); "> % A, % B % E, % Y [% I: % m % P]
-- Double click
<Br/>
<B> date #3: </B> <input type = "text" name = "date3" id = "sel3" size = "30"
> <Input type = "reset" value = "..."
Onclick = "Return showcalendar ('sel3', '% d/% m/% y');"> % d/% m/% Y
-- Single click
<Br/>
<B> date #4: </B> <input type = "text" name = "date4" id = "sel4" size = "30"
> <Input type = "reset" value = "..."
Onclick = "Return showcalendar ('sel4', '% A, % B % E, % y');"> % A, % B % E, % Y --
Double click
</Form>
</Body>
</Html>

The entire program contains a JS folder, a CSS folder, and an index.html file.

Attachment download

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.