2012-05-29 50 views
0

这是与为什么Google Chrome会将MediaWiki中的搜索栏清空?

我创建了一个JavaScript来输入文本到MediaWiki搜索框中,具体取决于复选框的选择。这现在适用于Firefox和Internet Explorer。但不在Google Chrome

在Chrome中,搜索框被正确填充(使用前面提到的JavaScript),但搜索框在搜索按钮被按下时空白(空白)。这意味着搜索URL也是空白的,这意味着只显示默认的MediaWiki搜索页面。

什么是Chrome与the code FF和IE不是 - 我该如何解决这个问题?

回答

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(); 

它的工作原理,但我不知道为什么。

相关问题