name="searchContent" id="searchContent" ></td>
搜索出現傳遞參數亂碼的解決方法(一般是跨系統搜索)
搜索框:
<script type="text/javascript">
function onSumbit_search(){
var v = document.all.searchContent.value;
var v1 = encodeURI(v);
document.getElementById("textfield").value=v1;
if ( (document.all.textfield.value=="請輸入檢索內容") || (document.all.textfield.value=="") ) {
window.alert("請輸入檢索內容!");
document.all.textfield.focus();
return false;
}
document.form_search.submit();
}
</script>
<form name="form_search" target="_blank" method="post" action="http://xxx/test.jsp">
<input type=hidden value="" id=textfield name=textfield>
<tr>
<th class="tr" width="100">名稱:</th>
<td class="tl"><input οnfοcus="this.value=''" maxLength="100" value="請輸入檢索內容"
name="searchContent" id="searchContent" ></td>
name="searchContent" id="searchContent" ></td>
</tr>
<tr>
<th class="tr"> </th>
<td class="tl"><a href="javascript:onSumbit_search();" class="nw-btn">搜索</a> </td>
</tr>
</form>
在test.jsp中獲取到的參數需要進行解碼:
<%@page import="java.net.URLDecoder"%>
String title=URLDecoder.decode(title1, "utf-8");
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.