关于decodeURIComponent无法使用
<form action="tool.html" method = "get"> 查找您想要的应用 <input name="searchFor" type="text" size="10" /> <input name="goButton" type="submit" value="搜索" /> </form>
var qs = window.location.search.substring(1);var ar = qs.split('&');var tmp = ar[0].split('=');var str = decodeURI(tmp[1]);
//IE下执行下面这样代码会报错?不可能吧!alert(decodeURIComponent('%E6%B5%8B%E8%AF%95'));
[解决办法]
是的。你可以试一下。如果是gbk编码,你需要把经 encodeURIComponent() 编码后的值传递过去。那边才可以decodeURIComponent 解码。