我想将我的页面重定向到即将到达我的变量的url,但它不工作时没有提示。没有提醒页面没有通过jquery重定向
如果我把警报然后重定向否则不。
$(document).ready(function(){
$("a").click(function(){
var newurl = 'http://www.xyz.com/' + $(this).attr('href');
//$(this).attr(newurl,'href');
window.location.href = newurl;
alert(newurl);
});
});
提前感谢名单
锚标记
<a href="includes/footer.jsp">new url</a>
您无法阻止默认操作,该操作位于链接中的URL后面。这将优先于手动设置URL(因为默认操作稍后发生并因此覆盖更改)。请参阅http://api.jquery.com/event.preventDefault/。为什么它使用'alert',我不知道。它可能以某种方式取消默认操作。 – 2013-05-01 09:10:59