お名前

メールアドレス

   


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
<meta http-equiv="Content-Style-Type" content="text/css">
<title>フォームの送信やリセットをする時に処理したい</title>
<script type="text/JavaScript">
<!--
function mailchk() {
if (document.frm1.tbox_name.value == ""){
alert("お名前を入力してください。");
return false;
}
if (document.frm1.tbox_mail.value == ""){
alert("メールアドレスを入力してください。");
return false;
}
alert("ありがとうございました。");
return true;
}
function reschk() {
var flag = confirm("入力内容をすべてリセットします。よろしいですか?");
return flag;
}
// -->
</script>
</head>
<body>
<form name="frm1" action="mailto:info@shin-sapporo.com" method="post" enctype="text/plain" onsubmit="return mailchk()" onreset="return reschk()">
<p>お名前<br>
<input type ="text" name="tbox_name" size="50"></p>
<p>メールアドレス<br>
<input type ="text" name="tbox_mail" size="70"></p>
<p><input type="submit" value="送信ボタン">&nbsp;&nbsp;&nbsp;<input type="reset" value="リセットボタン"></p>
</form>

</body>
</html>


★解説★