【发布时间】:2010-10-20 08:02:26
【问题描述】:
点击任何本地链接时,我需要更改它的href。 我已经弄清楚如何选择正确的链接并创建新的 url,但不确定如何更改位置。我需要确定任何其他点击事件也已运行,因此我不能立即更改位置。
var my_host = 'example.com';
$(document).click(function(e) {
if(e.target.hostname == my_host)
{
alert(e.target.protocol + "//" + e.target.hostname + "/#" + e.target.pathname + e.target.search);
//...
}
});
这和我的earlier question有关。
【问题讨论】:
标签: javascript jquery