記事投稿  :  検索  :  アクセス情報  :  記事一覧  :  リンク  :  カレンダー  
TECH-UNO The best way to predict the future is to invent it!
ようこそ! Tech-uno.com
金曜日, 2010年 9月 10日 @ 午前 01:05 JST
   

HTML: submit と button の違い

システム開発HTML の input タグの type="submit" と type="button" の違いを見てみましょう。

【sample1.html】

<html><body>
<form method="get" action="page2.html">
<input type="submit" value="submit1" onclick="location.href='page1.html'" />
<input type="submit" value="submit2" />
<input type="button" value="button1" onclick="location.href='page1.html'" />
<input type="button" value="button2" />
</form>
</body></html>

【sample2.html】

<html><body>
<form method="get">
<input type="submit" value="submit3" onclick="location.href='page1.html'" />
<input type="submit" value="submit4" />
</form>
</body></html>

【page1.html】

<html><body>page1</body></html>

【page2.html】

<html><body>page2</body></html>

【結果】

・sample1.html の submit1 押下: page2.html に画面遷移します。
・sample1.html の submit2 押下: page2.html に画面遷移します。
・sample1.html の button1 押下: page1.html に画面遷移します。
・sample1.html の button2 押下: 画面遷移しません。
・sample2.html の submit3 押下: 画面遷移しません。
・sample2.html の submit4 押下: 画面遷移しません。

トラックバック

このエントリのトラックバックURL: http://tech-uno.com/public_html//trackback.php?id=20081015224446325

HTML: submit と button の違い | 0 件のコメント | アカウントの作成
コメントは投稿者の責任においてなされるものであり、サイト管理者は責任を負いません。