フォーム


method属性の省略

formのmethodを省略するとGET

GET

formのmethodにGETを指定

post

formのmethodにpostを指定

結果を他のwindowに表示

formのtaget属性に_blankを指定


記事へ戻る --- 愚鈍人ホーム
JavaScriptの参考書 /  Ajaxの参考書 /  HTMLの参考書 /  CSSの参考書

 


htmlソース

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>フォーム</title>
<link href="/gudon/css/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>フォーム</h1>
<hr />
<h2>method属性の省略</h2>
<p>formのmethodを省略するとGET</p>
<form name="form1" action="test1.php">
	<input name="textbox1" type="text" value="テキストボックス"/>
	<input name="submitButton" type="submit" value="submitボタン"/>
</form>
<script type="text/javascript">
	alert(document.form1.method);
</script>

<h2>GET</h2>
<p>formのmethodにGETを指定</p>
<form action="test1.php" method="get">
	<input name="textbox1" type="text" value="テキストボックス"/>
	<input name="submitButton" type="submit" value="submitボタン"/>
</form>

<h2>post</h2>
<p>formのmethodにpostを指定</p>
<form action="test1.php" method="post">
	<input name="textbox1" type="text" value="テキストボックス"/>
	<input name="submitButton" type="submit" value="submitボタン"/>
</form>

<h2>結果を他のwindowに表示</h2>
<p>formのtaget属性に_blankを指定</p>
<form action="test1.php" target="_blank">
	<input name="textbox1" type="text" value="テキストボックス"/>
	<input name="submitButton" type="submit" value="submitボタン"/>
</form>
</body>
</html>