<!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. Linux创建WiFi热点

    手机流量用完,需要开WiFi,由于是LinuxMint,感觉配置还算容易,找到一个不错的教程,收藏一下,以备后用.除了修改配置文件那步在我的电脑不需要外其他基本正确,而且Mint本来就衍生自Ubunt ...

  2. 利用django创建一个投票网站(五)

    创建你的第一个 Django 项目, 第五部分 这一篇从第四部分(en)结尾的地方继续讲起.我们在前几章成功的构建了一个在线投票应用,在这一部分里我们将其创建一些自动化测试. 自动化测试简介 自动化测 ...

  3. 将文件移出版本控制 (Revision Control)

    两条重要的 Git 命令: git rm -r -n --cached /path/to/the/directory git rm -r --cached /path/to/the/directory ...

  4. 【转载】STL之priority_queue

    参考资料:传送门先回顾队列的定义:队列(queue)维护了一组对象,进入队列的对象被放置在尾部,下一个被取出的元素则取自队列的首部.priority_queue特别之处在于,允许用户为队列中存储的元素 ...

  5. 安装jhipster

    基础软件安装 安装JDK,需要配置环境变量.暂时使用1.8版本 安装maven,需要配置环境变量.  http://maven.apache.org/ 安装Node.js ,https://nodej ...

  6. php实现文件上传与下载(中)

    出现不想让用户看见的信息,可以使用错误抑制符号@:当然能echo的东西都是可以赋值给一个变量的: 定义用户上传文件类型,将其放在数组变量allowExt中,用if(!in_array(第一个参数为获取 ...

  7. html5图像组合

    一 图像组合 1.绘制阴影 在绘制阴影效果时,需要使用Canvas的多个属性配合完成 shadowBlur设置阴影的迷糊级数 shadowOffsetX设置形状与阴影的水平距离 shadowOffse ...

  8. 如何使用跨平台工具创建 NuGet 包(转)

    原文地址 https://docs.microsoft.com/zh-cn/dotnet/articles/core/deploying/creating-nuget-packages 内容 对于 . ...

  9. Android中AIDL的理解与使用(一)——跨应用启动/绑定Service

    AIDL(Android Interface Definition Language)--安卓接口定义语言 一.startService/stopService 1.同一个应用程序启动Service: ...

  10. Safari new Date()

    最近在敲代码的时候不觉得Safari有什么兼容问题,相比较的更多的时候再考虑ie,结果今天就栽在了Safari日期格式化上面了. 正如前面说的没有特别注意Safari的兼容问题所以特地粘贴这个打开Sa ...