<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
<style type="text/css">
#Header /*标题样式*/ {
height: 21px;
font-family: "宋体";
font-size: 12px;
} #LDay td /*星期的单元格样式*/ {
width: 30px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
} #LBody td /*日期的单元格样式*/ {
width: 30px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
color: #999;
font-weight: bold;
}
</style>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.js"></script> <script type="text/javascript">
var today = new Date();
var year = today.getFullYear(); //本年
var month = today.getMonth() + 1; //本月
var day = today.getDate();
$(function () {
calendar('')
})
//实现日历
function calendar(o) { if (o == 'subtract')
{
month = month - 1;
if (month < 1)
{
month = 12
year=year - 1;
} }
if (o == 'add') {
month = month + 1;
if (month > 12)
{
month = 1;
year = year + 1;
}
}
//本日
$("#showDate").html(year+'-'+month+'-'+day);
//本月第一天是星期几(距星期日离开的天数)
var startDay = new Date(year, month - 1, 1).getDay(); //本月有多少天(即最后一天的getDate(),但是最后一天不知道,我们可以用“上个月的0来表示本月的最后一天”)
var nDays = new Date(year, month, 0).getDate(); //开始画日历
var numRow = 0; //记录行的个数,到达7的时候创建tr
var i; //日期
var html = '';
html += '<table id="Body" width="212"><tbody>';
//第一行
html += '<tr>';
for (i = 0; i < startDay; i++) {
html += '<td></td>';
numRow++;
}
for (var j = 1; j <= nDays; j++) {
//如果是今天则显示红色
if (j == day) {
html += '<td style="color:red" onclick="' + "alert('今天是" + j + "号');" + '">';
html += '<input type="checkbox">' + j; //开始加日期
}
else {
html += '<td onclick="' + "alert('你点的是" + j + "号');" + '">';
html += '<input type="checkbox">'+j; //开始加日期
}
html += '</td>';
numRow++;
if (numRow == 7) { //如果已经到一行(一周)了,重新创建tr
numRow = 0;
html += '</tr><tr>';
}
} html += '</tbody></table>';
document.getElementById("Container").innerHTML = html;
}
function addMonth()
{
calendar('add');
}
function SubtractMonth()
{
calendar('subtract');
}
</script>
</head> <body>
<table id="Calendar" width="212">
<tr>
<td height="21" bgcolor="#78b3ed" width="212">
<table id="LHeader" height="21" width="212">
<tbody>
<tr align="center">
<td align="center" onclick="addMonth('subtract')" width="21">&lt;</td>
<td align="center">
<span id="showDate">2010.01</span>
</td>
<td align="center" onclick="SubtractMonth('add')" width="21">&gt;</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="18">
<table id="LDay" bgcolor="#e7f1fd">
<tbody>
<tr>
<td>日</td>
<td>一</td>
<td>二</td>
<td>三</td>
<td>四</td>
<td>五</td>
<td>六</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="120" width="212" id="Container"></td>
</tr>
</table>
</body>
</html> //--------------------------------------------------------------------------第二版带价格------------------------------------------------------------------------------------------------------------------------

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
<style type="text/css">
#Header /*标题样式*/ {
height: 21px;
font-family: "宋体";
font-size: 12px;
}

#LDay td /*星期的单元格样式*/ {
width: 50px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
}

#LBody td /*日期的单元格样式*/ {
width: 30px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
color: #999;
font-weight: bold;
}
</style>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.js"></script>

<script type="text/javascript">
var today = new Date();
var year = today.getFullYear(); //本年
var month = today.getMonth() + 1; //本月
var day = today.getDate();
$(function () {
calendar('')
})
//实现日历
function calendar(o) {

if (o == 'subtract')
{
month = month - 1;
if (month < 1)
{
month = 12
year=year - 1;
}

}
if (o == 'add') {
month = month + 1;
if (month > 12)
{
month = 1;
year = year + 1;
}
}
//本日
$("#showDate").html(year+'-'+month+'-'+day);
//本月第一天是星期几
var startDay = new Date(year, month - 1, 1).getDay();

//本月有多少天
var nDays = new Date(year, month, 0).getDate();

//开始画日历
var numRow = 0; //记录行的个数,到达7的时候创建tr
var i; //日期
var html = '';
html += '<table id="Body" width="350"><tbody>';
//第一行
html += '<tr>';
for (i = 0; i < startDay; i++) {
html += '<td></td>';
numRow++;
}
for (var j = 1; j <= nDays; j++) {
//如果是今天则显示红色
if (j == day) {
html += '<td style="color:red" onclick="' + "alert('今天是" + j + "号');" + '">';
html += parseInt(Math.random() * 5, 10) + '元<input type="checkbox"/>' + j; //开始加日期
}
else {
html += '<td onclick="' + "alert('" + j + "号');" + '">';
html += parseInt(Math.random() * 5, 10) + '元<input type="checkbox"/>' + j; //开始加日期
}
html += '</td>';
numRow++;
if (numRow == 7) {
numRow = 0;
html += '</tr><tr>';
}
}

html += '</tbody></table>';
document.getElementById("Container").innerHTML = html;
}
function addMonth()
{
calendar('add');
}
function SubtractMonth()
{
calendar('subtract');
}
</script>
</head>

<body>
<table id="Calendar" width="350">
<tr>
<td height="21" bgcolor="#78b3ed" width="350">
<table id="LHeader" height="21" width="350">
<tbody>
<tr align="center">
<td align="center" onclick="addMonth('subtract')" width="21">&lt;</td>
<td align="center">
<span id="showDate">完整日期</span>
</td>
<td align="center" onclick="SubtractMonth('add')" width="21">&gt;</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="18">
<table id="LDay" bgcolor="#e7f1fd">
<tbody>
<tr>
<td>日</td>
<td>一</td>
<td>二</td>
<td>三</td>
<td>四</td>
<td>五</td>
<td>六</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="120" width="350" id="Container"></td>
</tr>
</table>
</body>
</html>

----------------------------------------完善版------------------------------------------------------------------

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8" />
<style type="text/css">
#Header {
height: 21px;
font-family: "宋体";
font-size: 12px;
}

#LDay td {
width: 80px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
}

#LBody td {
width: 30px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
color: #999;
font-weight: bold;
}
#Body tr td {
width:80px;
align-content:center;
text-align: center
}
</style>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.js"></script>

<script type="text/javascript">
var PriceList = [
{
"BasePrice": 407.0000,
"CheckInDateStr": "2016\/7\/14 0:00:00",
"CheckOutDateStr": "2022\/12\/30 0:00:00",
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"DayPriceList": [
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/21",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 254.0000,
"Rackrate": 530.0000,
"SellPrice": 354.6000,
"Week": "星期三"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/22",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 389.0000,
"Rackrate": 530.0000,
"SellPrice": 624.6000,
"Week": "星期四"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/23",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 234.0000,
"Rackrate": 530.0000,
"SellPrice": 535.6000,
"Week": "星期五"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/24",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 2312.0000,
"Rackrate": 530.0000,
"SellPrice": 4353.6000,
"Week": "星期六"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/25",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 678.0000,
"Rackrate": 530.0000,
"SellPrice": 809.6000,
"Week": "星期日"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/26",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 456.0000,
"Rackrate": 530.0000,
"SellPrice": 456.6000,
"Week": "星期一"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/27",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 567.0000,
"Rackrate": 530.0000,
"SellPrice": 799.6000,
"Week": "星期二"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/28",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 313.0000,
"Rackrate": 530.0000,
"SellPrice": 375.6000,
"Week": "星期三"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/29",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 313.0000,
"Rackrate": 530.0000,
"SellPrice": 375.6000,
"Week": "星期四"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/30",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 3433.0000,
"Rackrate": 530.0000,
"SellPrice": 375.6000,
"Week": "星期五"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2016\/12\/31",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 345345.0000,
"Rackrate": 530.0000,
"SellPrice": 6755.6000,
"Week": "星期六"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/1",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 5678.0000,
"Rackrate": 530.0000,
"SellPrice": 4325.6000,
"Week": "星期日"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/2",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 34567.0000,
"Rackrate": 530.0000,
"SellPrice": 35655.6000,
"Week": "星期一"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/3",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 2573.0000,
"Rackrate": 530.0000,
"SellPrice": 3465.6000,
"Week": "星期二"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/4",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 85433.0000,
"Rackrate": 530.0000,
"SellPrice": 37605.6000,
"Week": "星期三"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/5",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 89076.0000,
"Rackrate": 530.0000,
"SellPrice": 2896.6000,
"Week": "星期四"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/6",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 7676.0000,
"Rackrate": 530.0000,
"SellPrice": 5674.6000,
"Week": "星期五"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/7",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 3537.0000,
"Rackrate": 530.0000,
"SellPrice": 9779.6000,
"Week": "星期六"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/8",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 6865.0000,
"Rackrate": 530.0000,
"SellPrice": 9769.6000,
"Week": "星期日"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/9",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 4674.0000,
"Rackrate": 530.0000,
"SellPrice": 8969.6000,
"Week": "星期一"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/10",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 9678.0000,
"Rackrate": 530.0000,
"SellPrice": 4566.6000,
"Week": "星期二"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/11",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 7864.0000,
"Rackrate": 530.0000,
"SellPrice": 3456.6000,
"Week": "星期三"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/12",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 6786.0000,
"Rackrate": 530.0000,
"SellPrice": 6786.6000,
"Week": "星期四"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/13",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 6786.0000,
"Rackrate": 530.0000,
"SellPrice": 5677.6000,
"Week": "星期五"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/14",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 3525.0000,
"Rackrate": 530.0000,
"SellPrice": 3255.6000,
"Week": "星期六"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/15",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 2423.0000,
"Rackrate": 530.0000,
"SellPrice": 5345.6000,
"Week": "星期日"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/16",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 235432.0000,
"Rackrate": 530.0000,
"SellPrice": 35345.6000,
"Week": "星期一"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/17",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 2435.0000,
"Rackrate": 530.0000,
"SellPrice": 3545.6000,
"Week": "星期二"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/18",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 2345.0000,
"Rackrate": 530.0000,
"SellPrice": 2543.6000,
"Week": "星期三"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/19",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price":3453.0000,
"Rackrate": 530.0000,
"SellPrice": 4534.6000,
"Week": "星期四"
},
{
"BasePrice": 407.0000,
"ChildBasePrice": 0.0000,
"ChildPrice": 0.0000,
"ChildRackrate": 0.0000,
"ChildSellPrice": 0.0000,
"Date": "2017\/1\/20",
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 4654.0000,
"Rackrate": 530.0000,
"SellPrice": 45645.6000,
"Week": "星期五"
}
],
"LPid": 5049,
"Lid": 2629,
"MaxAdvance": 60,
"MinAdvance": 1,
"Name": "跟团游",
"Number": 200,
"OldBasePrice": 0.0000,
"OldPrice": 0.0000,
"OldRackrate": 0.0000,
"OldSellPrice": 0.0000,
"Price": 313.0000,
"Rackrate": 530.0000,
"SellPrice": 375.6000,
"Sort": 0
}
];
var today = new Date();
var year = today.getFullYear(); //本年
var month = today.getMonth() + 1; //本月
var day = today.getDate();
$(function () {
calendar('')
})

function calendar(o,priceList) {

if (o == 'subtract') {
month = month - 1;
if (month < 1) {
month = 12
year = year - 1;
}

}
if (o == 'add') {
month = month + 1;
if (month > 12) {
month = 1;
year = year + 1;
}
}

$("#showDate").html(year + '/' + month + '/' + day);

var startDay = new Date(year, month - 1, 1).getDay();

var nDays = new Date(year, month, 0).getDate();

var numRow = 0;
var i;
var html = '';
html += '<table id="Body" width="560"><tbody>';

html += '<tr>';
for (i = 0; i < startDay; i++) {
html += '<td></td>';
numRow++;
}
for (var j = 1; j <= nDays; j++) {
// $(priceList).each(function (index, objPrice) {
// if (objPrice.)
var tempObj;
var tempDate=year + '/' + month + '/' + j;
$(PriceList[0].DayPriceList).each(function (index, objPrice) {
if (objPrice.Date == tempDate)
{
tempObj = objPrice
}
})
if (j == day) {
html += '<td style="color:red">';
html += '¥' +(tempObj==undefined?'0':tempObj.Price) + '</br>¥' + (tempObj==undefined?'0':tempObj.SellPrice) + '</br><input type="checkbox"/>' + '<lable>' + j + '</lable>';
}
else {
html += '<td>';
html += '¥' + (tempObj==undefined?'0':tempObj.Price) + '</br>¥' + (tempObj==undefined?'0':tempObj.SellPrice)
+ '</br><input type="checkbox"/>' + '<lable>' + j + '</lable>';
}

// });

html += '</td>';
numRow++;
if (numRow == 7) {
numRow = 0;
html += '</tr><tr>';
}
}

html += '</tbody></table>';
document.getElementById("Container").innerHTML = html;
}
function cutDate(dateTime)
{

}
function addMonth() {
calendar('add');
$("input[type=checkbox]").prop("checked", false)
}
function SubtractMonth() {
calendar('subtract');
$("input[type=checkbox]").prop("checked", false)
}
Array.prototype.indexOf = function (el) {
for (var i = 0, n = this.length; i < n; i++) {
if (this[i] === el) {
return i;
}
}
return -1;
}
$(function () {
$("#checkAll").click(function () {
if ($("#checkAll").prop("checked") == true) {
$("input[type=checkbox]").prop("checked", true);
}
else {
$("input[type=checkbox]").prop("checked", false)
}

})

$("input[name='week']").click(function () {

$(this).parent().prevAll().length

checkWeedDay($(this).parent().prevAll().length, $(this).prop("checked"))

});
})
function checkWeedDay(weekIndex, checked) {
$("#Body").children().find("tr").each(function (indextr, objtr) {
$(objtr).children().eq(weekIndex).find("input[type='checkbox']").prop("checked", checked)
});
}
function GetSelectedDate() {
var dataArray = new Array();
var MainDate = $("#showDate").html().substring(0, 6);
$("#Body").children().find("input[type='checkbox']").each(function () {
if ($(this).prop('checked')) {
var tempStr = $(this).next().html();
var selectedDate = (tempStr.length > 1) ? tempStr : '0' + tempStr;
var fullDate = MainDate + '/' + selectedDate;

dataArray.push(fullDate);
}
})
return (JSON.stringify(dataArray));
}
</script>
</head>

<body>
<table id="Calendar" width="560">
<tr>
<td height="21" bgcolor="#78b3ed" width="560">
<table id="LHeader" height="21" width="560">
<tbody>
<tr align="center">
<td align="center" onclick="SubtractMonth('add')" width="21">&lt;</td>
<td align="center">
<span id="showDate">fullDate</span>
<input type="checkbox" id="checkAll" />全选
</td>
<td align="center" onclick="addMonth('subtract')" width="21">&gt;</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="18">
<table id="LDay" bgcolor="#e7f1fd">
<tbody>
<tr>
<td>日<input name="week" type="checkbox" /></td>
<td>一<input name="week" type="checkbox" /></td>
<td>二<input name="week" type="checkbox" /></td>
<td>三<input name="week" type="checkbox" /></td>
<td>四<input name="week" type="checkbox" /></td>
<td>五<input name="week" type="checkbox" /></td>
<td>六<input name="week" type="checkbox" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height="120" width="560" id="Container"></td>
</tr>
</table>
<input type="button" value="获取选中日期" onclick="GetSelectedDate()" />
</body>
</html>

ReWriteDateControll的更多相关文章

随机推荐

  1. Sublime Text编辑器的12个技巧和诀窍

    本文为您提供Sublime Text编辑器的12个技巧和诀窍,深入挖掘这个看似简洁的代码编辑器,背后所隐藏的实现各种高级功能的无限可能. 1) 选择 以下是一些Sublime Text选择文本的快捷键 ...

  2. Web应用请求和响应 HTTP相关

    (1)请求:浏览器以HTTP协议的方式提交请求到服务器 (2)响应:服务器以HTTP协议的方式响应内容到浏览器 注意:HTTP是WEB大众化非安全协议 HTTPS是WEB安全协议,是基于HTTP协议的 ...

  3. Python 3.5源码编译安装

    系统环境:CentOS 6.8-Minimal 安装Python依赖包: [root@Python src]# yum install zlib-devel bzip2-devel openssl-d ...

  4. 【JavaWeb】Spring+SpringMVC+MyBatis+SpringSecurity+EhCache+JCaptcha 完整Web基础框架(一)

    Spring+MyBatis 首先要搭建的是Spring+MyBatis的整合框架,毕竟Spring是整个Web框架的核心部位,而数据库操作是一切测试的基础嘛. 目录结构 ━java ┣ contro ...

  5. 命令行提交本地项目到github上

    1.github账号要有. 2.配置ssh key ①  defaults write com.apple.finder AppleShowAllFiles -bool true     终端 显示隐 ...

  6. Linux学习笔记<六>

    进程与程序 1.子程序与父程序 PID是进程的ID,PPID是其父进程的ID 登录bash之后,就是获取了一个名为bash的PID,在这个环境上所执行的其他命令,就是其子程序 common@commo ...

  7. RabbitMQ学习系列(六): RabbitMQ 高可用集群

    前面讲过一些RabbitMQ的安装和用法,也说了说RabbitMQ在一般的业务场景下如何使用.不知道的可以看我前面的博客,http://www.cnblogs.com/zhangweizhong/ca ...

  8. ASP.NET 判断客户端是否为手机的函数

    http://www.cnblogs.com/cxd4321/p/3795911.html

  9. java内存泄漏的几种情况

    转载于http://blog.csdn.net/wtt945482445/article/details/52483944 Java 内存分配策略 Java 程序运行时的内存分配策略有三种,分别是静态 ...

  10. SpringMVC学习记录3

    这次的主题 最近一直在学习SpringMVC..(这句话我已经至少写了3,4遍了....).这次的研究主要是RequestMappingHandlerAdapter中的各种ArgumentsResol ...