如果您在 Google 中搜索某些内容(例如 StackOverFlow),则在搜索结果页面中您可以看到 StackOverFlow 项目作为结果。
当您将鼠标悬停在 StackOverFlow 项目浏览器中时,会显示它是一个引用 stackoverflow.com 的 anchor 元素。 。但是,当您右键单击该项目并单击复制链接地址
时,URL 为 this .
Google 是如何做到的?
最佳答案
<a id="changeMe" href="http://foo.com">click me</a>
正如评论中提到的,猜测这很简单:
$('#changeMe').mousedown(function(){
$(this).attr('href', "http://bar.com")
});
关于html - Google 如何更改搜索结果页面中的网址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16644010/