这是模版原来的搜索样式及链接
<h2 class="ss_h2"><input name="" class="fl text_1" id="txtKeyword" value="请输入搜索内容" onkeydown="return searchEnter(event);" onclick="if(this.value=='请输入搜索内容')this.value=''" onblur="if(this.value=='')this.value='请输入搜索内容'" type="text">
<a href="#" onclick="Search();return false;"><img src="images/ss_but.jpg" class="fr ss_but"></a></h2>
························································
找到个js代码实现表单提交功能的代码
<script type="text/javascript">
function formSubmit(){
document.getElementById("scbar_form").submit()
}
</script>
<div id="search">
<form id="scbar_form" method="get" action="11" class="text">
<input id="query" type="text" size="27" name="srchtxt" autocomplete="off" placeholder="搜索你喜欢的" value="" class="default_value">
<a id="search_lens" type="button" onclick="document.getElementById('scbar_form').submit()">点这里用JS提交表单!</a>
</form>
</div>
·····················································
head加上
<script type="text/javascript">
function formSubmit(){
document.getElementById("scbar_form").submit()
}
</script>
这是修改后的搜索样式及链接
<form id="scbar_form" method="get" name="search" action="search">
<h2 class="ss_h2"><input name="keyword" class="fl text_1" id="txtKeyword" value="请输入搜索内容" onkeydown="return searchEnter(event);" onclick="if(this.value=='请输入搜索内容')this.value=''" onblur="if(this.value=='')this.value='请输入搜索内容'" type="text">
<a id="search_lens" type="submit" onclick="document.getElementById('scbar_form').submit()">
<img src="{$=ii_get_actual_route('images')}/ss_but.jpg" class="fr ss_but"></a>
<input type="submit" value="{$=ii_itake('global.lng_config.search','lng')}" class="button" />
</h2>
</form>
如果搜索页面再搜索,路径是 /search/search?keyword=11,
或者一级目录、二级目录下搜索路径都不对,这样的话,
就把<form> 里面的action="search"修改为action="{$=ii_get_actual_route('search')}"
这样不管是在哪个页面搜索,路径都不会错的。