剛開始學(xué)js,我使用的是 http://foxrunsoftware.github.io/DatePicker/一個(gè)js插件,下面是代碼,直接copy官網(wǎng)的demo,運(yùn)行后,點(diǎn)擊輸入框,沒有出現(xiàn)日期,查了半天,都沒查到。。求助!!
<html>
<title>test</title>
<head>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="./datepicker/js/datepicker.js"></script>
<link rel="stylesheet" type="text/css" href="./datepicker/css/base.css" />
<link rel="stylesheet" type="text/css" href="./datepicker/css/clean.css" />
<script>
$('#inputDate').DatePicker({
mode: 'single',
position: 'right',
onBeforeShow: function(el){
if($('#inputDate').val())
$('#inputDate').DatePickerSetDate($('#inputDate').val(), true);
},
onChange: function(date, el) {
$(el).val((date.getMonth()+1)+'/'+date.getDate()+'/'+date.getFullYear());
if($('#closeOnSelect input').attr('checked')) {
$(el).DatePickerHide();
}
}
});
</script>
</head>
<body>
<input id="inputDate" class="inputDate" value="" >
<label id="closeOnSelect" class="checkbox"><input type="checkbox" checked="checked"> Close on selection</label>
</body>
</html>
光陰似箭催人老,日月如移越少年。
在chrome調(diào)試下報(bào)這個(gè)錯(cuò)
$.curCSS is not a function
原因是你的jquery版本太高了,curCSS是已被廢棄的方法,把jquery源換成1.7.1就好了
<script src="http://cdn.bootcss.com/jquery/1.7.1/jquery.min.js"></script>
這個(gè)插件太老了,換別的吧