location.href为什么在IE里无法实现跳转 location.href = "?typetext&word=" + encodeURI($('word').value);而encodeURI在火狐可以实现跳转,但如果是中文encodeURI得出不是编码,直接显示的是中文字 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 location.href = "?typetext&word=" + encodeURIComponent($('word').value);这样试试~· 你其他代码有问题吧,我这样运行是没问题的IE6<html><head><script>function a(){ location.href = "?typetext&word=" + encodeURI("中文");}</script></head><body onclick="a()"></body></html> 运行后地址栏多了?typetext&word=%E4%B8%AD%E6%96%87 把 href="javascript:;"或者href="javascript:viod(0)"改成 href="#" 或者 href="###" 在location.href = "?typetext&word=" + encodeURI($('word').value);后面加上return false; 那是火狐的地址栏的人性化设计,自动decodeURL 应该就是这样了,你用这个网址试试http://dict.cn/另外地址栏即使显示为中文,你的后台程序有影响吗?如果没有影响那是没有关系的另外 一个测试文档<html><head><script>function a(){ alert(encodeURI("中文")); location.href = "?typetext&word=" + encodeURI("中文");}</script></head><body onclick="a()"></body></html> 本人很郁闷,代码如下(IE6无效)<input type="text" value="" name="word" id="word" /><a href="javascript:void(0);" onclick="submitSearch()"></a><script language="javascript">function submitSearch(){ var sUrl = "?type=text&word=" + encodeURI($('word').value); location.href = sUrl;}</script> 定义了的,我就奇怪了不过换成<input type="button" onclick="submitSearch()">就可以,就不知道是什么原因照理说我在href="javascript:void(0);" 就应该没有什么问题了。 唉,人总会犯低级错误。解决方法 <a href="javascript:submitSearch();"></a> 请教一个关于动态ID的设置与获取问题,谢谢! jquery ui中的slider怎么实现垂直滑动 如下代码,提示tip未定义!如何解决 普通变量的生命周期 AJAX能否做到递交整个页面而不刷新页面?换句话说就是AJAX能不能实现SUBMIT的功能而不刷新页面? 一个关于加密解密的问题的求教 怎么实现给输入框设置字数限制,点击按钮判断输入格式正确后给一个数据接口 document.cookie可以得到所有最近设置的cookie,那怎么可以得到cookie里每个的name 哪里有EtCell报表控件的下载呀? 关于<input type="file"> 使用cookie实现自动登录 js的小问题
location.href = "?typetext&word=" + encodeURIComponent($('word').value);这样试试~·
<head>
<script>
function a(){
location.href = "?typetext&word=" + encodeURI("中文");
}
</script>
</head>
<body onclick="a()"></body>
</html>
?typetext&word=%E4%B8%AD%E6%96%87
改成
href="#" 或者 href="###"
location.href = "?typetext&word=" + encodeURI($('word').value);
后面加上
return false;
另外地址栏即使显示为中文,你的后台程序有影响吗?如果没有影响那是没有关系的另外 一个测试文档<html>
<head>
<script>
function a(){
alert(encodeURI("中文"));
location.href = "?typetext&word=" + encodeURI("中文");
}
</script>
</head>
<body onclick="a()"></body>
</html>
<input type="text" value="" name="word" id="word" />
<a href="javascript:void(0);" onclick="submitSearch()"></a><script language="javascript">
function submitSearch()
{
var sUrl = "?type=text&word=" + encodeURI($('word').value);
location.href = sUrl;
}
</script>
不过换成<input type="button" onclick="submitSearch()">就可以,就不知道是什么原因
照理说我在href="javascript:void(0);" 就应该没有什么问题了。