post2.html
1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title>Ajax的なフォーム入力値のチェック</title>
<link href="common.css" rel="stylesheet" type="text/css" />
<link href="post2.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="post2.js"></script>
</head>
<body bgcolor="#ffffff">
<h1>Ajax的なフォーム入力値のチェック</h1>
<p>
入力フォームにデータを入力して「送信」ボタンを押すと、その送信されたデータの値が画面に表示されます。
サーバ側で入力値をチェックしますが、もし入力に不備があると、そのエラーメッセージが送られてきます。
送られてきたエラーメッセージが、画面上に表示され、エラーとなった入力欄の色が変わり、フォーカスがあたります。
</p>
<hr />
<h2>■ 送信フォーム</h2>
<form action="post2.cgi" id="sendForm">
<div>
名前:
<input type="text" id="yourname" name="yourname" size="30" autocomplete="off" />
<span id="e_yourname"></span>
</div>
<div>
年齢:
<input type="text" id="age" name="age" size="3" autocomplete="off" />
<span id="e_age"></span>
</div>
<div>
<input type="button" name="sendBtn" id="sendBtn" value="送信" />
<div>
</form>
</body>
</html>