以下がアンケートアプリの実装例です。セキュリティ脆弱性を避けるために、evalや他のサイトへの遷移、リダイレクトは行いません。
```
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>アンケートアプリ</title>
<style>
label {
display: block;
margin-bottom: 10px;
}
input[type="radio"],
input[type="checkbox"] {
margin-right: 5px;
}
input[type="submit"] {
margin-top: 10px;
}
</style>
</head>
<body>
<h1>アンケートアプリ</h1>
<form>
<label>1. 性別は?<br>
<input type="radio" name="gender" value="male">男性<br>
<input type="radio" name="gender" value="female">女性
</label>
<label>2. 年齢は?<br>
<input type="radio" name="age" value="10s">10代<br>
<input type="radio" name="age" value="20s">20代<br>
<input type="radio" name="age" value="30s">30代<br>
<input type="radio" name="age" value="40s">40代<br>
<input type="radio" name="age" value="50s">50代以上
</label>
<label>3. チョコレート派?それとも苦手派?<br>
<input type="radio" name="chocolate" value="like">好き<br>
<input type="radio" name="chocolate" value="dislike">苦手
</label>
<label>4. 一番好きなフルーツは?<br>
<select name="favorite-fruit">
<option value="apple">りんご</option>
<option value="orange">みかん</option>
<option value="banana">バナナ</option>
<option value="strawberry">いちご</option>
</select>
</label>
<label>5. 「プログラマーと電波系アイドル、どっちがかっこいい?」<br>
<input type="checkbox" name="programmer" value="cool">プログラマー<br>
<input type="checkbox" name="idol" value="cool">電波系アイドル
</label>
<input type="submit" value="送信">
</form>
<script>
const form = document.querySelector('form');
form.addEventListener('submit', function(event) {
event.preventDefault();
const formData = new FormData(form);
const result = {};
for (const [key, value] of formData.entries()) {
result[key] = value;
}
alert('回答ありがとうございます!');
console.log(result);
});
</script>
</body>
</html>
```
ジョークとしては、アイドルとプログラマーの比較問題があるのは、プログラマーがコードを書くことで仕事を成し遂げるのに対し、アイドルはファンのサポートが必要だから?という意味でしょうか。ただし、少しセクシャルなニュアンスもあるかもしれませんので、注意してください。