<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>休み期間と顧客番号を入力してください</title>
</head>
<body>
<h1>休み期間と顧客番号を入力してください</h1>
<form>
<label for="start_date">休み期間開始年月日:</label>
<input type="date" id="start_date" name="start_date"><br>
<label for="end_date">休み期間終了年月日:</label>
<input type="date" id="end_date" name="end_date"><br>
<label for="product_name">商品名:</label>
<input type="text" id="product_name" name="product_name"><br>
<label for="customer_id">顧客番号:</label>
<input type="text" id="customer_id" name="customer_id"><br>
<input type="button" value="送信" onclick="checkInputs()">
</form>
<script>
function checkInputs() {
var startDate = document.getElementById("start_date").value;
var endDate = document.getElementById("end_date").value;
var productName = document.getElementById("product_name").value;
var customerId = document.getElementById("customer_id").value;
if (!startDate || !endDate || !productName || !customerId) {
alert("すべての項目を入力してください");
return;
}
if (startDate > endDate) {
alert("開始年月日は終了年月日よりも前に設定してください");
return;
}
if (customerId.length !== 6) {
alert("顧客番号は6桁で入力してください");
return;
}
// 入力内容が正しい場合、ここに処理を追加してください
console.log(`開始日:${startDate}、終了日:${endDate}、商品名:${productName}、顧客番号:${customerId}`);
alert("送信が完了しました!");
}
</script>
</body>
</html>