0

これはで始まった物語です

チェックボックスの選択に応じて、MediaWiki検索ボックスにテキストを入力するJavaScriptを作成しました。これはFirefoxとInternetExplorerで機能するようになりました。しかし、GoogleChromeにはありませ

Chromeでは、検索ボックスは(前述のJavaScriptで)正しく入力されていますが、検索ボタンを押すと検索ボックスが空白(空)になります。これは、検索URLも空白になっていることを意味します。つまり、デフォルトのMediaWiki検索ページのみが表示されます。

FFとIEがそうではないコードでChromeは何をしていますか?これを修正するにはどうすればよいですか?

4

1 に答える 1

0

私のPHPコードには、次のJavaScriptを埋め込みました。

<script type="text/javascript">function appendAndSubmit(){var platform1 = document.getElementById('p1').checked;var platform2 = document.getElementById('p2').checked;var text = document.getElementById('searchboxInput').value;if (platform1 * platform2 >0) text = text + ' "Applies to=Platform 1.0" "Applies to=Platform 2.0"';else if (platform1) text = text + ' "Applies to=Platform 1.0"';else if (platform2) text = text + ' "Applies to=Platform 2.0"';document.getElementById('searchboxInput').value = text;document.forms['searchform'].submit();}</script>

変数textは、検索フォームにあるものとして定義されました。だから私は単に最後の部分を変更しました:

document.forms['searchform'].submit();

text.submit();

動作しますが、理由はわかりません。

于 2012-05-29T15:43:44.720 に答える