所以我要在我的表此单元格在我的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