<!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 /*星期的单元格样式*/ { 30px; height: 30px; text-align: center; font-family: "宋体"; font-size: 12px; } #LBody td /*日期的单元格样式*/ { 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"><</td> <td align="center"> <span id="showDate">2010.01</span> </td> <td align="center" onclick="SubtractMonth('add')" width="21">></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 /*星期的单元格样式*/ {
50px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
}
#LBody td /*日期的单元格样式*/ {
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"><</td>
<td align="center">
<span id="showDate">完整日期</span>
</td>
<td align="center" onclick="SubtractMonth('add')" width="21">></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 {
80px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
}
#LBody td {
30px;
height: 30px;
text-align: center;
font-family: "宋体";
font-size: 12px;
color: #999;
font-weight: bold;
}
#Body tr td {
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"><</td>
<td align="center">
<span id="showDate">fullDate</span>
<input type="checkbox" id="checkAll" />全选
</td>
<td align="center" onclick="addMonth('subtract')" width="21">></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>