JQuery calendar per day

Source: Internet
Author: User

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Script type = "text/javascript" src = "JQuery/jquery-1.5.1.js"> </script>
<Title> untitled document </title>
<Style type = "text/css">
*{
Padding: 0;
Margin: 0;
}
. TableHead_table {
Width: 95%;
Margin: 0 auto;
Border-top: 1px solid #000;
Border-left: 1px solid #000;
}
. TableHead_table tr td {
Border-right: 1px solid #000;
Border-bottom: 1px solid #000;
}

. RiCheng_td {
Width: 40px;
Text-align: center;
}
. Day_td,. plan_td,. do_td {
Width: 15px;
}

. Plan_td {
Background: # CACAFF;
}

. ChuFaTd {
Background: # FC9;
}
. ChuFaTd2 {
Background: # F00;
}
</Style>
<Script type = "text/javascript" defer>
Function autoDayAndBackground (chuFaTr_jqu, chuFaTd_jqu, day ){
Var implementDate = chuFaTr_jqu.find ("input [name = 'implementdate _ hid ']"). val ();
Var implementDateArray = new Array ();
Var allDayValue = ''; // The last string used to store all the selected days
Var isHadHas = 0; // determines whether the number of days clicked already exists.

ImplementDateArray = implementDate. split (",");
For (var I = 0; I <implementDateArray. length; I ++) {// search to determine whether the click date has been selected
HasDay = implementDateArray [I];
If (hasDay = 0 | hasDay = '')
Continue;
If (day = hasDay) {// if this date has been selected, click Cancel again
ChuFaTd_jqu.removeClass ("chuFaTd ");
IsHadHas = 1;
} Else {
AllDayValue + = (hasDay + ",");
}
}

If (isHadHas = 0 ){
ChuFaTd_jqu.addClass ("chuFaTd ");
AllDayValue + = (day + ",");
}
ChuFaTr_jqu.find ("input [name = 'implementdate _ hid ']"). val (allDayValue );
}

$ (". Plan_td,. do_td"). click (function (){
Var chuFaTd_jqu = $ (this );
Var chuFaTr_jqu = chuFaTd_jqu.parent ();
Var day = chuFaTd_jqu.attr ("name ");

If (chuFaTd_jqu.hasClass ("do_td ")){
AutoDayAndBackground (chuFaTr_jqu, chuFaTd_jqu, day );

} Else if (chuFaTd_jqu.hasClass ("plan_td ")){
Var planBeginDate = chuFaTr_jqu.find ("input [name = 'planbegindate _ hid ']"). val () * 1;
If (day = planBeginDate ){
ChuFaTr_jqu.find ("input [name = 'planbegindate _ hid ']"). val (0 );
ChuFaTd_jqu.removeClass ("chuFaTd2 ");
} Else {
ChuFaTr_jqu.find ("td [name = '" + planBeginDate + "']"). removeClass ("chuFaTd2 ");
ChuFaTr_jqu.find ("input [name = 'planbegindate _ hid ']"). val (day );
ChuFaTd_jqu.addClass ("chuFaTd2 ");
}
}
});
</Script>
</Head>

<Body>
<Table name = "tableHead_table" class = "tableHead_table">

<Tr>
<Td class = "updateDate_td"> Update date </td>
<Td class = "fuZeRen_td"> owner </td>
<Td class = "workContent_td"> Work Item </td>
<Td class = "workType_td"> Category </td>
<Td class = "riCheng_td"> schedule </td>
<? Php
For ($ I = 1; $ I <32; $ I ++ ){
?>
<Td class = "day_td"> <? Php echo $ I?> </Td>
<? Php
}
?>
<Td> consumption item basis </td>
<Td> achievement rate </td>
</Tr>
<? Php listTR (1)?>
<? Php listTR (2)?>
<? Php listTR (3)?>
<? Php listTR (4)?>
<? Php listTR (5)?>
<? Php listTR (6)?>
<? Php listTR (7)?>
<Tr>
<Td colspan = "38"> </td>
</Tr>
</Table>

<? Php
Function listTr ($ id ){
?>
<Tr name = "tr <? Php echo $ id?> "Class =" listTrPlan ">
<Td rowspan = "2"> 1 </td>
<Td rowspan = "2"> 2 </td>
<Td rowspan = "2"> 3 </td>
<Td rowspan = "2"> 4 </td>
<Td class = "riCheng_td"> plan </td>
<? Php
For ($ I = 1; $ I <32; $ I ++ ){
?>
<Td name = "<? Php echo $ I?> "Class =" plan_td "> </td>
<? Php
}
?>
<Td rowspan = "2"> 5 </td>
<Td rowspan = "2"> 6 </td>
<Input type = "hidden" name = "planBeginDate_hid" value = "0"/>
</Tr>

<Tr name = "tr <? Php echo $ id?> "Class =" listTrDo ">
<Td class = "riCheng_td"> Implementation </td>
<? Php
For ($ I = 1; $ I <32; $ I ++ ){
?>
<Td name = "<? Php echo $ I?> "Class =" do_td "> </td>
<? Php
}
?>
<Input type = "hidden" name = "implementDate_hid" value = ""/>
</Tr>
<? Php
}
?>
</Body>
</Html>
 

From cool ass

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.