var jsonData = { total: 0, rows: [] }; //初始化JSON对象 var thisYear = -1; var thisMonth = -1; var thisDay = -1; var thisIndex = 0; $(document).ready(function () { var nowdate = new Date(); thisYear = nowdate.getFullYear(); thisMonth = nowdate.getMonth() + 1; thisDay = nowdate.getDate() + 1; var nCurYear = nowdate.getFullYear(); var nCurMonth = nowdate.getMonth(); var nCurDay = nowdate.getDate() + 1; if (Request.QueryString("year") != null && Request.QueryString("year") != undefined) { thisYear = Request.QueryString("year"); } if (Request.QueryString("month") != null && Request.QueryString("month") != undefined) { thisMonth = Request.QueryString("month"); } if (Request.QueryString("day") != null && Request.QueryString("day") != undefined) { thisDay = Request.QueryString("day"); } if (Request.QueryString("index") != null && Request.QueryString("index") != undefined) { thisIndex = Request.QueryString("index"); } //alert(nCurYear + "-" + nCurMonth + "-" + nCurDay); var userAgentInfo = navigator.userAgent; var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; var flag = true; for (var v = 0; v < Agents.length; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } if (flag) { // $("#datepicker").datepicker({//添加日期选择功能   // showButtonPanel: true, //是否显示按钮面板   // dateFormat: 'yy-mm-dd', //日期格式   // clearText: "清除", //清除日期的按钮名称   // closeText: "关闭", //关闭选择框的按钮名称   // yearSuffix: '年', //年的后缀   // currentText: '今天', // numberOfMonths: 2, // showMonthAfterYear: true, //是否把月放在年的后面  // minDate: new Date(nCurYear, nCurMonth, nCurDay), // defaultDate: new Date(thisYear, thisMonth, thisDay), //默认日期   // monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], // dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], // dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], // dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'], // onSelect: function (selectedDate) {//选择日期后执行的操作  // var dtCurDate = new Date(); // var dtSelectDate = new Date(selectedDate.replace("-", "/")); // // if (dtSelectDate <= dtCurDate) { // alert("只能预定明天以后的日期,请重新选择预定日期!"); // return; // } // // var strs = new Array(); // strs = selectedDate.split("-"); // thisYear = strs[0]; // thisMonth = strs[1]; // thisDay = strs[2]; // // //alert(thisYear + thisMonth + thisDay); // //curdate = selectedDate; // getContent(); // } // }); //var curdate = $(".date").get(thisIndex); //$(curdate).trigger("click"); } else { // $("#datepicker").datepicker({//添加日期选择功能   // showButtonPanel: true, //是否显示按钮面板   // dateFormat: 'yy-mm-dd', //日期格式   // clearText: "清除", //清除日期的按钮名称   // closeText: "关闭", //关闭选择框的按钮名称   // yearSuffix: '年', //年的后缀   // currentText: '今天', // numberOfMonths: 2, // showMonthAfterYear: true, //是否把月放在年的后面  // minDate: new Date(nCurYear, nCurMonth, nCurDay), // defaultDate: new Date(thisYear, thisMonth, thisDay), //默认日期   // monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'], // dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'], // dayNamesShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'], // dayNamesMin: ['日', '一', '二', '三', '四', '五', '六'], // onSelect: function (selectedDate) {//选择日期后执行的操作  // var dtCurDate = new Date(); // var dtSelectDate = new Date(selectedDate.replace("-", "/")); // // if (dtSelectDate <= dtCurDate) { // alert("只能预定明天以后的日期,请重新选择预定日期!"); // return; // } // // var strs = new Array(); // strs = selectedDate.split("-"); // thisYear = strs[0]; // thisMonth = strs[1]; // thisDay = strs[2]; // // //alert(thisYear + thisMonth + thisDay); // //curdate = selectedDate; // getContent(); // }, // beforeShow: function (input, inst) { // $.datepicker._pos = $.datepicker._findPos(input); // //$.datepicker._pos[0] = 300;    // $.datepicker._pos[1] += input.offsetTop + 390; // 加入body的scrollTop修正jquery在ie7中定位不準的問題   // inst.dpDiv.css('font-size', '90%'); // //alert($.datepicker._pos[0] + ":" + $.datepicker._pos[1]);   // } // }); } //$("#datepicker").datepicker('setDate', thisYear + "-" + thisMonth + "-" + thisDay); var date_ele = document.getElementById("datepicker"); var month_t =nCurMonth.toString(); if (nCurMonth + 1 < 10) month_t = '0' + (nCurMonth + 1); var day_t = nCurDay.toString(); if (nCurDay < 10) day_t = '0' + (nCurDay + 1) var dateString = nCurYear + "-" + (month_t) + "-" + day_t; date_ele.value = dateString; getContent(); }); function showoff() { alert("对不起,该时间段的票已订完!"); } function handler(e) { var selectDate = e.target.value; var dtCurDate = new Date(); var dtSelectDate = new Date(selectDate.replace("-", "/")); if (dtSelectDate <= dtCurDate) { alert("只能预定明天以后的日期,请重新选择预定日期!"); var nCurYear = dtCurDate.getFullYear(); var nCurMonth = dtCurDate.getMonth(); var nCurDay = dtCurDate.getDate() + 1; var date_ele = document.getElementById("datepicker"); var month_t =nCurMonth.toString(); if (nCurMonth + 1 < 10) month_t = '0' + (nCurMonth + 1); var day_t = nCurDay.toString(); if (nCurDay < 10) day_t = '0' + (nCurDay + 1) var dateString = nCurYear + "-" + (month_t) + "-" + day_t; date_ele.value = dateString; getContent(); return; } var strs = selectDate.split("-"); thisYear = strs[0]; thisMonth = strs[1]; thisDay = strs[2]; getContent(); } function getContent() { /*点击输出*/ $("#booking_ul").empty(); $("#curyear").empty(); $("#curmonth").empty(); $("#curday").empty(); $("#curIndex").empty(); RX.Remoting("get", "bllBooking", "getBookingInfo", "{year:\"" + thisYear + "\",month:\"" + thisMonth + "\",day:\"" + thisDay + "\"}", function (result) { if (result.Status) { if (result.Data.length > 0) { var objData = result.Data; $.each(objData, function (i) { if (objData[i].isclose == 0) { var strContent = '
  • '; strContent = strContent + ''; strContent = strContent + '

    ' + objData[i].perioddesp + '

    '; strContent = strContent + objData[i].count + ''; if (objData[i].count > 0 && objData[i].isold != 1) { strContent = strContent + '订票'; } else { strContent = strContent + '订票'; } strContent = strContent + '
  • '; //alert(strContent); $("#booking_ul").append(strContent); } else { $("#booking_ul").append("今日全天闭馆,请选择其他预约时间。"); } }); $("#curyear").val(dateArr[j].y); $("#curmonth").val(dateArr[j].m); $("#curday").val(dateArr[j].d); $("#curIndex").val(j); QueueHander(); } } else { alertEx(result.Msg); } }); } function search() { location.href = "/culturalcentre/show.php?id=24071&year="+thisYear+"&month="+thisMonth+"&day="+thisDay; } function OnInput(event) { alert ("The new content: " + event.target.value); }