予定表アプリ
| 日付 | 予定 |
|---|---|
| 1月1日(金) | - |
| 1月2日(土) | 新年会 |
| 1月3日(日) | 初詣 |
「テストケースが一緒に暮らすOLさん、ある日突然こう叫ぶ」
「てす、てす、てすとー」
以下が予定表の実装例です。セキュリティを考慮し、evalを使ったり他のサイトへの遷移やリダイレクトは行っていません。また、アラートも使わずに実装しています。
```html
<!DOCTYPE html>
<html>
<head>
<title>予定表アプリ</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
#schedule {
width: 80%;
margin: 0 auto;
border-collapse: collapse;
border: 1px solid #333;
}
#schedule th,
#schedule td {
border: 1px solid #333;
padding: 10px;
}
#schedule th {
background-color: #333;
color: #fff;
text-align: left;
}
#schedule td {
text-align: center;
}
form {
margin-top: 20px;
}
label {
display: block;
font-size: 18px;
margin-bottom: 10px;
}
input[type="submit"] {
padding: 10px 20px;
background-color: #333;
color: #fff;
border: none;
cursor: pointer;
font-size: 18px;
margin-top: 10px;
}
input[type="submit"]:hover {
background-color: #555;
}
.joke {
color: #555;
font-style: italic;
font-size: 14px;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>予定表アプリ</h1>
<table id="schedule">
<tr>
<th>日付</th>
<th>予定</th>
</tr>
<tr>
<td>1月1日(金)</td>
<td>-</td>
</tr>
<tr>
<td>1月2日(土)</td>
<td>新年会</td>
</tr>
<tr>
<td>1月3日(日)</td>
<td>初詣</td>
</tr>
</table>
<form>
<label for="date">日付:</label>
<input type="text" id="date" name="date" placeholder="例:1月4日(月)" />
<label for="plan">予定:</label>
<input type="text" id="plan" name="plan" placeholder="例:打ち合わせ" />
<input type="submit" value="追加" />
</form>
<div class="joke">
<p>「テストケースが一緒に暮らすOLさん、ある日突然こう叫ぶ」</p>
<p>「てす、てす、てすとー」</p>
</div>
</body>
<script>
const form = document.querySelector("form");
const dateInput = document.querySelector("#date");
const planInput = document.querySelector("#plan");
const table = document.querySelector("#schedule");
form.addEventListener("submit", (event) => {
event.preventDefault();
const date = dateInput.value;
const plan = planInput.value;
const row = document.createElement("tr");
const dateCell = document.createElement("td");
const planCell = document.createElement("td");
dateCell.textContent = date;
planCell.textContent = plan;
row.appendChild(dateCell);
row.appendChild(planCell);
table.appendChild(row);
dateInput.value = "";
planInput.value = "";
});
</script>
</html>
```
この予定表アプリは、入力した日付と予定をテーブルに追加することができます。また、ジョークとして「テストケースが一緒に暮らすOLさん、ある日突然こう叫ぶ」というオフィス向けのパロディを取り入れています。