這是模版原來的搜索樣式及鏈接
<h2 class="ss_h2"><input name="" class="fl text_1" id="txtKeyword" value="請輸入搜索內(nèi)容" onkeydown="return searchEnter(event);" onclick="if(this.value=='請輸入搜索內(nèi)容')this.value=''" onblur="if(this.value=='')this.value='請輸入搜索內(nèi)容'" type="text">
<a href="#" onclick="Search();return false;"><img src="images/ss_but.jpg" class="fr ss_but"></a></h2>
························································
找到個js代碼實(shí)現(xiàn)表單提交功能的代碼
<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()">點(diǎn)這里用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="請輸入搜索內(nèi)容" onkeydown="return searchEnter(event);" onclick="if(this.value=='請輸入搜索內(nèi)容')this.value=''" onblur="if(this.value=='')this.value='請輸入搜索內(nèi)容'" 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')}"
這樣不管是在哪個頁面搜索,路徑都不會錯的。