メールアドレス用の入力フィールドを作るには?
input type="email"タグの書式
input type="email"タグに対応しているブラウザ
※Windows 7上で動作確認を行っています。
※ブラウザの設定より、異なる挙動をする場合があります。
input type="email"タグの属性一覧
属性 | 内容 |
グローバル属性 | ※グローバル属性のページを参照してください。 |
value | 初期値を指定します。 |
指定可能なフォーム部品の共通属性 | name、disabled、form、autocomplete、autofocus、maxlength、pattern、readonly、required、size、placeholder ※フォーム部品の共通属性のページを参照してください。 |
input type="email"タグの解説
<input>タグは、入力コントロールを表すための要素です。
<input>要素の「type」属性に「email」を指定すると、メールアドレス用の入力フィールドを作ることができます。
メールアドレス形式でない文字列を入力して送信ボタン(type="submit"のボタン)を押すと、ブラウザによっては送信せずに警告を表示します。
input type="email"タグのサンプルソース1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル1</title>
</head>
<body>
<form action="sample.cgi" method="post">
<p><label>担当者名: <input name="n"></label></p>
<p><label>住所: <input name="adr"></label></p>
<p><label>Tel:<input type="tel" name="tel"></label></p>
<p><label>Email:<input type="email" name="email" size="40"></label></p>
<p><input type="submit" value="送信する"></p>
</form>
</body>
</html>
input type="email"タグのサンプル画面1
input type="email"タグのサンプルソース2
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>サンプル2</title>
</head>
<body>
<form action="sample.cgi" method="post">
<fieldset>
<legend>顧客情報</legend>
<p><label>顧客名:<input name="n"></label></p>
<p><label>職業: <input name="n"></label></p>
<p><label>Tel: <input type="tel"></label></p>
<p><label>Email: <input type="email" name="email" size="40"></label></p>
<p><input type="submit" value="送信"></p>
</fieldset>
</form>
</body>
</html>
input type="email"タグのサンプル画面2
input type="email"タグの関連項目