所以我要在我的表此單元格在我的div:的Javascript:寫在特定的細胞
<body>
<div>
<table id="TableName" width="auto">
<thead>
<tr>
...
<th colspan="7" style="background-color: black; color: white; text-align: left;">
<div id="last_thursday" />
</th>
</tr>
這個代碼寫的日期在其上週四的價值。
$(document).ready(Main);
function Main() {
ConfigDate();
}
function ConfigDate() {
var currentTime = new Date();
var dayofWeek = currentTime.getDay();
var daysSinceThursday = (dayofWeek + 3) % 7
var lastThursday = new Date(currentTime.GetDate() - daysSinceThursday);
var dd = lastThursday.getDate();
var mm = lastThursday.getMonth() + 1;
var yyyy = lastThursday.getFullYear();
$("#last_thursday").text(yyyy + "/" + mm + "/" + dd);
}
有人能告訴我我在做什麼錯在這裏導致我的代碼在我的單元格中根本寫不出來?
'GetDate'應該是'getDate' – jbabey