我來自荷蘭,我在學校。我有一個約會,但現在我想顯示從那天起的一個工作日。我如何從約會中獲得一天
<!DOCTYPE html>
<html>
<head>
<script>
function getWeekday(d) {
alert (d);
var date = new Date();
var weekday = new Array(7);
weekday[0] = "Zondag";
weekday[1] = "Maandag";
weekday[2] = "Dinsdag";
weekday[3] = "Woensdag";
weekday[4] = "Donderdag";
weekday[5] = "Vrijdag";
weekday[6] = "Zaterdag";
}
function d() {
document.getElementById("Weekdag").innerHTML = getWeekday ("2050-01-01");
}
</script>
</head>
<body>
<p>Laat een weekdag zien</p>
<button onclick="d()">Klik voor weekdag</button>
<p id="Weekdag"></p>
</body>
</html>
關於Stack Overflow問題不是研究的替代方法。首先,進行基礎研究,包括[在這裏徹底搜索](/ search?q =%5Bjs%5D + get + day + of + week),然後在發佈您的問題時解釋您所做的研究。 –
另請選擇:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array – mplungjan
下面是一個工作代碼:http://codepen.io/yosvelquintero/pen/yVpwRW –