【Web】Google 検索のボタンを付ける

web開発

概要

  • 以下のように検索Boxを作成します。
  • いずれも検索ボタンを押下するとGoogle検索ができます。
  • 検索窓があるものと、無いものの違いです。

ソース

  • ソースは、以下のようになります。
  • 1つめの検索は、検索窓+検索ボタンがあり、2つ目の検索は、検索ボタンのみです。
  • 1,2つめの違いは、検索窓にtype=”text”の代わりにtype=”hidden”となっているだけです。
<!DOCTYPE html>
<html lang="ja">
  <head>
    <meta charset="UTF-8">
    <title>Google検索</title>
  </head>
  <body>


    <h1>検索Boxの書き方</h1>

    <form method="get" action="https://www.google.co.jp/search" target="_blank">
        <input type="text" name="q" size="31" maxlength="255" value="神戸   ポートタワー">
		<input type="submit" name="btng" value="検索">
		<input type="hidden" name="hl" value="ja">
	</form>
    <br>
    <br>
    <form method="get" action="https://www.google.co.jp/search" target="_blank">
        <input type="hidden" name="q" size="31" maxlength="255" value="神戸   ポートタワー">
		<input type="submit" name="btng" value="検索">
		<input type="hidden" name="hl" value="ja">
	</form>
	
  </body>
</html>
スポンサーリンク
web開発
Engineerをフォローする
レンサバ