form表单用ge方式提交时ie显示中文参数乱码

时间:2024-06-07 22:38:02

有网友说 通过给form表单添加accept-charset="gb2312"和 onsubmit="document.charset='gb2312'" 但这样没能解决我的问题,我的源码是这样的:

form表单用ge方式提交时ie显示中文参数乱码

这样做后,ie搜索还是不能成功,

后这样就可以了:

    <form method="get" target="_blank" id="searchform" name="searchform" accept-charset="gb2312" onsubmit="document.charset='gb2312';">
<input type="hidden" value="" name="searchtimes" />
<input type="hidden" value="simple" name="kind" />
<input type="hidden" name="client_id" value="web_search" />
<input type="hidden" value="qx" name="suchen_match" />
<input type="hidden" name="suchen_way" value="Ya" />
<input type="hidden" name="show_type" value="wenzi" />
<input type="hidden" name="library_id" value="all" />
<input type="hidden" name="suchen_type" value="" />
<input type="hidden" name="recordtype" value="all" />
<input type="text" class="search_input2" size="" name="suchen_word" id="suchen_word" style="width:300px" />
<input type="submit" value="校内提交" class="btn_seac" id="searchin" />
<input type="submit" value="校外提交" class="btn_seac" id="seachout" />
</form>
<script>
$(function () {
$("#searchin").click(function () {
searchform.action = "http://10.32.0.10/opac_two/search2/searchout.jsp";
$("#searchform").charset = "gb2312";
$("#searchform").submit();
})
$("#seachout").click(function () {
searchform.action = "http://218.107.150.8/opac_two/search2/searchout.jsp";
$("#searchform").charset = "gb2312";
$("#searchform").submit();
})
})
</script>

顺便丢个链接:关于urlencode , encodeURIComponent
http://www.blogjava.net/freeman1984/archive/2010/06/07/322965.html