Javascriptのフォーム



0   名前: はるちゃん : 2006/03/02 13:58
複数のサイトを検索出来るCGIフォームを
作成したのですが、幾つかのサイトはGET経由
でしか、使えません。質問なのですが、
例えば、以下のフォームでMSNを選択した場合にmethod=""の中の
部分がgetに変わるJavascriptはないのでしょうか?

<form method="post" action="/cgi-bin/metasearch.cgi">
<select name="site" size="1">
<option>Yahoo
<option>MSN
<option>Google
</select>
<input type="text" name="search">
<input type="submit" value="Search">
</form>

1   名前: m035 : 2006/03/02 13:58  [URL
<form method="post" action="/cgi-bin/metasearch.cgi" onsubmit="this.form.method=(this.form.site.selectedIndex==1?'get':'post');return true">
<select name="site" size="1">
<option>Yahoo
<option>MSN
<option>Google
</select>
<input type="text" name="search">
<input type="submit" value="Search">
</form>

以上で出来るかも知れません。(未確認)

一覧へ戻る