<!DOCTYPE html> <html lang="th"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>ระบบจองรถไปงาน</title> <style> body { font-family: Arial, sans-serif; margin: 20px; background-color: #f2f2f2; } h1 { text-align: center; color: #333; } .form-container { background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); width: 50%; margin: 0 auto; } .form-group { margin-bottom: 15px; } label { display: block; margin-bottom: 5px; } input, button { width: 100%; padding: 10px; font-size: 16px; border: 1px solid #ddd; border-radius: 4px; } button { background-color: #4CAF50; color: white; cursor: pointer; } button:hover { background-color: #45a049; } .booking-details { margin-top: 20px; background-color: #fff; padding: 10px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); } </style> </head> <body> <h1>ระบบจองรถไปงาน</h1> <div class="form-container"> <form id="bookingForm"> <div class="form-group"> <label for="name">ชื่อผู้จอง:</label> <input type="text" id="name" name="name" required> </div> <div class="form-group"> <label for="date">วันที่ของงาน (DD-MM-YYYY):</label> <input type="text" id="date" name="date" placeholder="เช่น 25-12-2025" required> </div> <div class="form-group"> <label for="time">เวลา (HH:MM AM/PM):</label> <input type="text" id="time" name="time" placeholder="เช่น 10:00 AM" required> </div> <div class="form-group"> <label for="location">สถานที่ของงาน:</label> <input type="text" id="location" name="location" required> </div> <button type="submit">จองรถ</button> </form> </div> <div id="bookingDetails" class="booking-details" style="display: none;"> <h3>รายละเอียดการจอง</h3> <p><strong>ชื่อผู้จอง:</strong> <span id="detailName"></span></p> <p><strong>วันที่ของงาน:</strong> <span id="detailDate"></span></p> <p><strong>เวลา:</strong> <span id="detailTime"></span></p> <p><strong>สถานที่ของงาน:</strong> <span id="detailLocation"></span></p> </div> <script> document.getElementById('bookingForm').addEventListener('submit', function(event) { event.preventDefault(); // รับข้อมูลจากฟอร์ม var name = document.getElementById('name').value; var location = document.getElementById('location').value; // แสดงรายละเอียดการจอง document.getElementById('detailName').innerText = name; document.getElementById('detailLocation').innerText = location; // แสดงส่วนรายละเอียดการจอง document.getElementById('bookingDetails').style.display = 'block'; // เคลียร์ข้อมูลจากฟอร์ม }); </script> </body> </html>
Standard input is empty
<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ระบบจองรถไปงาน</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color: #f2f2f2;
}
h1 {
text-align: center;
color: #333;
}
.form-container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 50%;
margin: 0 auto;
}
.form-group {
margin-bottom: 15px;
}
label {
display: block;
margin-bottom: 5px;
}
input, button {
width: 100%;
padding: 10px;
font-size: 16px;
border: 1px solid #ddd;
border-radius: 4px;
}
button {
background-color: #4CAF50;
color: white;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
.booking-details {
margin-top: 20px;
background-color: #fff;
padding: 10px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<h1>ระบบจองรถไปงาน</h1>
<div class="form-container">
<form id="bookingForm">
<div class="form-group">
<label for="name">ชื่อผู้จอง:</label>
<input type="text" id="name" name="name" required>
</div>
<div class="form-group">
<label for="date">วันที่ของงาน (DD-MM-YYYY):</label>
<input type="text" id="date" name="date" placeholder="เช่น 25-12-2025" required>
</div>
<div class="form-group">
<label for="time">เวลา (HH:MM AM/PM):</label>
<input type="text" id="time" name="time" placeholder="เช่น 10:00 AM" required>
</div>
<div class="form-group">
<label for="location">สถานที่ของงาน:</label>
<input type="text" id="location" name="location" required>
</div>
<button type="submit">จองรถ</button>
</form>
</div>
<div id="bookingDetails" class="booking-details" style="display: none;">
<h3>รายละเอียดการจอง</h3>
<p><strong>ชื่อผู้จอง:</strong> <span id="detailName"></span></p>
<p><strong>วันที่ของงาน:</strong> <span id="detailDate"></span></p>
<p><strong>เวลา:</strong> <span id="detailTime"></span></p>
<p><strong>สถานที่ของงาน:</strong> <span id="detailLocation"></span></p>
</div>
<script>
document.getElementById('bookingForm').addEventListener('submit', function(event) {
event.preventDefault();
// รับข้อมูลจากฟอร์ม
var name = document.getElementById('name').value;
var date = document.getElementById('date').value;
var time = document.getElementById('time').value;
var location = document.getElementById('location').value;
// แสดงรายละเอียดการจอง
document.getElementById('detailName').innerText = name;
document.getElementById('detailDate').innerText = date;
document.getElementById('detailTime').innerText = time;
document.getElementById('detailLocation').innerText = location;
// แสดงส่วนรายละเอียดการจอง
document.getElementById('bookingDetails').style.display = 'block';
// เคลียร์ข้อมูลจากฟอร์ม
document.getElementById('bookingForm').reset();
});
</script>
</body>
</html>