请教href location.href是地址,而不是变量?地址是会自动加上前面那些的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 因为js是解释型语言,在window.location.href="GroupPhsManage.jsp";这句还没跳转的时候。已经执行了alert(window.location.href); location.href指向要转到的地址而不是一个变量 既然都执行到alert了,说明此时页面还没有跳转,当然显示原来的页面地址。如果立即跳转,那么就不执行alert了 试试这个就清楚了<script>function go(){window.location.replace("GroupPhsManage.jsp");setTimemout("alert(window.location.href)",1000);}</script><input type="button" onclick="go()" value="haha" /> var window=new Object();window.location=new Object();window.location.href="GroupPhsManage.jsp";alert(window.location.href);这样就出来GroupPhsManage.jsp了,哈哈 你要干嘛?如果要显示跳转的页面就在那个页面写ALERT啦你在这个页面写的话 当然是显示这个页面的地址啦~~ 大家似乎没有明白我的意思我是说,我觉得应该是这样的:要么就转到GroupPhsManage.jsp并且alert出GroupPhsManage.jsp,或者不alert;要么就不跳转,alert出当前页面的路径。但现在的情况是:先执行alert出当前页面的路径,再跳转。是不是href会自动在function的最后时刻执行而先执行后面的语句? window.location.href 只是一个字符串而已,并不会执行跳转事件你要跳转的话就 window.location="" 在执行了window.location后alert()是不会执行的 怎么在网页中动态地更换Flash文件 $.getJSON返回值内容能在文本框上换行吗 js 如何让input的onclick事件失效 请高手指点(急) 网页保存出错 求解释一段代码 -----汉字ansi 与 unicode 转换问题----- 斑主,在msdn里的这个功能是如何实现的。 怎样让文本框的底色为蓝色(或着透明) event.clientX 和event.offsetX 用Ajax无刷新能不能实现蜡烛的燃烧 如何在OnKeyUp事件中知道用户按下的哪一个键?
在window.location.href="GroupPhsManage.jsp";这句还没跳转的时候。已经执行了
alert(window.location.href);
如果立即跳转,那么就不执行alert了
<script>
function go(){
window.location.replace("GroupPhsManage.jsp");
setTimemout("alert(window.location.href)",1000);
}
</script>
<input type="button" onclick="go()" value="haha" />
window.location=new Object();
window.location.href="GroupPhsManage.jsp";
alert(window.location.href);这样就出来GroupPhsManage.jsp了,哈哈
你在这个页面写的话 当然是显示这个页面的地址啦~~
要么就转到GroupPhsManage.jsp并且alert出GroupPhsManage.jsp,或者不alert;
要么就不跳转,alert出当前页面的路径。但现在的情况是:先执行alert出当前页面的路径,再跳转。
是不是href会自动在function的最后时刻执行而先执行后面的语句?
你要跳转的话就 window.location=""
在执行了window.location后alert()是不会执行的