日期:2014-05-16 浏览次数:20381 次
document.write('<div id="djcamain" style="display:none;height:268px;width:210px;background:#f7ffff;border:2px solid #cecece;z-index:2;padding:2px;"><table width="100%"><tr><td id="jcatitle" align="center" height="26px" style="color: #ffffff" bgcolor="#666666">选择日期</td></tr><tr><td bgcolor="#0000ff" align="center" style="height:24px;" valign="middle"> <input id="txYear" width="50px" size=6 /> <select id="txMonth" style="height:24px;"></select></td></tr><tr><td><table cellpadding="0" cellspacing="1" border="0" class="tab" align="center" id="calbody"></table></td></tr></table><table id="caltoolbar"><tr><td height="24px"><input id="btJcaClose" type="button" value="关闭" class="jca_button" /> <input id="btJcaToday" type="button" value="选择今天" class="jca_button" /></td></tr></table></div>');
var clickObj;
var months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
var today = new Date();
var todayStr = today.getFullYear()+"-"+months[today.getMonth()]+"-"+today.getDate();
var initYear = today.getFullYear();
var initMonth = today.getMonth();
function selJca(obj){
clickObj = obj;
var objOffset = obj.offset();
// fixed absolute
$("#djcamain").css({
"position": "absolute",
"top": objOffset.top + obj.height() + 4,
"left": objOffset.left
});
$("#djcamain").fadeIn();
$("#txYear").attr("value", initYear);
$("#txMonth").empty();
for (var i = 0; i < months.length; i++){
if (i == initMonth){
$("<option selected='selected' value='"+months[i]+"'>"+months[i]+"月</option>").appendTo($("#txMonth"));
}else{
$("<option value='"+months[i]+"'>"+months[i]+"月</option>").appendTo($("#txMonth"));
}
}
createCalBody();
$("#txMonth").change(function(){
initMonth = parseInt($("#txMonth").val()) - 1;
createCalBody();
});
$("#btJcaClose").click(function(){
$("#djcamain").fadeOut();
});
$("#btJcaToday").click(function(){
var todayDate = today.getDate();
if (today.getDate() < 10){
todayDate = "0"+today.getDate();
}
$(clickObj).val(today.getFullYear()+"-"+months[today.getMonth()]+"-"+todayDate);
$("#djcamain").fadeOut();
});
if($.browser.msie){
document.getElementById("txYear").attachEvent("onpropertychange",yearChange);
}else{
document.getElementById("txYear").addEventListener("input",yearChange,false);
}
$("#jcatitle").mouseover(function(){
$(this).css({"cursor": "move"});
});
$("#jcatitle").mousedown(function(event){
var offset=$("#djcamain").offset();
x1 = event.clientX-offset.left; &