【发布时间】:2011-01-12 18:15:33
【问题描述】:
是否可以有一个链接,点击后执行href目标,但不弹出新窗口?
【问题讨论】:
是否可以有一个链接,点击后执行href目标,但不弹出新窗口?
【问题讨论】:
我认为您的意思是使用 jQuery,因为您已将其标记为这样。使用 ajax 调用将点击页面,如果您愿意,您可以在完成时执行操作。 e.preventDefault 将阻止点击(访问 url)发生。
这样的?
$("a#mylink").click(function(e){
var goto = $(this).attr('href'); //get the url
$.ajax({
url: goto
}); //execute the href
e.preventDefault(); //prevent click
});
【讨论】: