<!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. 样式重置 css reset

    新浪的初始化: html,body,ul,li,ol,dl,dd,dt,p,h1,h2,h3,h4,h5,h6,form,fieldset,legend,img { ; padding: 0 } fi ...

  2. console在调试中的常见用法

    console在不打断程序运行的情况下在控制台输出我们想要看到的信息: 一般情况下我们用来输入信息的方法主要是用到如下四个: 1.console.log 用于输出普通信息 2.console.info ...

  3. ubuntu下载工具uget和aria2

    一直想在ubuntu下找到个和迅雷差不多的下载工具.在网上找到了. 这篇文章完全是抄袭整理网上的. 我的系统版本是ubuntu14.04. 1.安装uget和aria2 sudo apt-get in ...

  4. ubuntu用作开发办公平台的完美体验

    2016年6月3日 对于使用使用linux操作系统作为办公平台的新手来说很不适应,需要在多种方式中找到自己喜欢,适合自己的方式比较难.摸索了很久终于发现了一个适合我自己的使用方式了.这种方式也适合其他 ...

  5. RocketMQ原理解析-Broker

    broker 1. broker的启动 brker的启动 Broker向namesrv注册 1. 获取namesrv的地址列表(是乱序的) 2. 遍历向每个namesrv注册topic的配置信息top ...

  6. Python Day12

    MySQL 数据库介绍 什么是数据库? 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库, 每个数据库都有一个或多个不同的API用于创建,访问,管理,搜索和复制所保存的数据. 我们 ...

  7. React视角下的轮播图

    天猫购物网站最显眼的就是轮播图了.我在学习一样新js库,一个新框架或新的编程思想的时候,总是感叹"入门必做选项卡,进阶须撸轮播图."作为一个React组件,它是状态操控行为的典型, ...

  8. Pivot Table

    1. Disable menu 'Disable show/hide Field list menu sht.PivotTables().EnableFieldList = False ''scrip ...

  9. nginx配置杂记

    1.一个接口的形式要求是:IP+端口,并且通信协议类型是:https,如何做域名解析: ①设置一个端口.同时在防火墙中打开这个端口,重启防火墙: ②在服务器上/etc/nginx/conf.d的目录下 ...

  10. repeater控件如何隐藏列?

    .aspX文件里将要隐藏的"<td>修改</td>"放在Lable标签里,隐藏实现,如:<asp:lable id=lable1 run=server ...