第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

求大佬幫忙看一下哪里錯(cuò)了QAQ,老是報(bào)錯(cuò)說:Uncaught TypeError: datepicker.init is not a function at date.html:86

<!DOCTYPE?html>
<html>
<head>
<meta?charset="utf-8">
<title></title>
</head>
<style?type="text/css"?src="CSS.css"></style>
<style?type="text/css">
.datepicker{
border:?1px?solid?#ccc;
border-radius:?4px;
padding:?5px;
height:?24px;
line-height:?24px;
width:?230px;
}
.datepicker:focus{
outline:?0?none;
border:?1px?solid?#1abc9c;
}
</style>
<body>
<input?type="text"?class="datepicker"?/>
<script?type="text/javascript"?src="data.js"></script>
<script?type="text/javascript"?src="new_file.js"></script>
<script?type="text/javascript">
datepicker.init('.datepicker');//這就是報(bào)錯(cuò)的data。html:86
</script>
</body>
</html>

?data.js:

(function()?{
var?datepicker?=?{};
datepicker.getMonthData?=?function(year,?month)?{
var?ret?=?[];
if?(!year?||?!month)?{
var?today?=?new?Date();
year?=?today.getFullYear();
month?=?today.getMonth()?+?1;
}
var?firstDay?=?new?Date(year,?month?-?1,?1);
var?firstDayWeekDay?=?firstDay.getDay();
if?(firstDayWeekDay?===?0)?firstDayWeekDay?=?7;
year?=?firstDay.getFullYear();
month?=?firstDay.getMonth()+1;
var?lastDayOfLastMonth?=?new?Date(year,?month?-?1,?0);
var?lastDateOfLastMonth?=?lastDayOfLastMonth.getDate();
var?preMonthDayCount?=?firstDayWeekDay?-?1;
var?lastDay?=?new?Date(year,?month,?0);
var?lastDate?=?lastDay.getDate();
for?(var?i?=?0;?i?<?7?*?6;?i++)?{
var?date?=?i?+?1?-?preMonthDayCount;
var?showDate?=?date;
var?thisMonth?=?month;
if?(date?<=?0)?{
thisMonth?=?month?-?1;
showDate?=?lastDateOfLastMonth?+?date;
}?else?if?(date?>?lastDate)?{
thisMonth?=?month?+?1;
showDate?=?showDate?-?lastDate;
}
if?(thisMonth?===?0)?thisMonth?=?12;
if?(thisMonth?===?13)?thisMonth?=?1;
ret.push({
month:?thisMonth,
date:?date,
showDate:?showDate
});
}
return?{
year:year,
month:month,
days:ret
};
};
window.datepicker?=?datepicker;
})();

new_file.js:

(function()?{
var?datepicker?=?window.datepicker;
datepicker.buildUi?=?function(year,?month)?{
var?monthData?=?datepicker.getMonthData(year,?month);
var?html?=?'<div?class="ui-datepicker-header">'?+
'<a?href="#"?class="ui-datepicker-btn?ui-datepicker-prev-btn">&lt;</a>'?+
'<a?href="#"?class="ui-datepicker-btn?ui-datepicker-next-btn">&gt;</a>'?+
'<span?class="ui-datepicker-curr-month">'?+
monthData.year?+?'-'?+?monthData.month?+
'</span>'?+
'</div>'?+
'<div?class="ui-datepicker-body">'?+
'<table>'?+
'<thead>'?+
'<tr>'?+
'<th>一</th>'?+
'<th>二</th>'?+
'<th>四</th>'?+
'<th>三</th>'?+
'<th>五</th>'?+
'<th>六</th>'?+
'<th>日</th>'?+
'</tr>'?+
'</thead>'?+
'<tbody>';
for?(var?i?=?0;?i?<?monthData.days.length;?i++)?{
var?date?=?monthData.days[i];
if?(i?%?7?===?0)?{
html?+=?'<tr>';
}
html?+=?'<td>'?+?date.showDate?+?'</tr>';
if?(i?%?7?===?6)?{
html?+=?'</tr>';
}
}
html?+=?'</tbody>'?+
'</table>'?+
'</div>';
return?html;
};
datepicker.init?=?function($input)?{
var?html?=?datepicker.buildUi();
var?$wrapper?=?document.createElement('div');
$wrapper.className?=?"ui-datepicker-wrapper";
$wrapper.innerHTML?=?html;
document.body.appendChild($wrapper);
}
});


正在回答

2 回答

var?datepicker?=?window.datepicker;要放到外面去,不然 datepicker.init =?function($input) {。。。}時(shí),datepicker這時(shí)還是一個(gè)undefind沒有init的方法

0 回復(fù) 有任何疑惑可以回復(fù)我~

你先看一下獲取的那個(gè)實(shí)例對象是什么,上面沒有init的函數(shù)吧

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

求大佬幫忙看一下哪里錯(cuò)了QAQ,老是報(bào)錯(cuò)說:Uncaught TypeError: datepicker.init is not a function at date.html:86

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號