![](/img/trans.png)
[英]Simple button and link insertion Firefox addon: insertAdjacentHTML usage
[英]Grab link on hover - Firefox addon
我想抓住鼠标悬停的基础链接地址。
即使我可以抓住状态栏中显示的链接,也足够了。
这是我正在创建的Firefox插件。
function mouseOver(event) {
alert(event.currentTarget.href);
event.preventDefault();
}
几个简单的步骤
使用jQuery会更简单,但这可以完成工作。
var links = document.getElementsByTagName("a");
for (i = 0; i < links.length; i++) {
links[i].addEventListener('mouseover',getLink,false)
//for less than ie9 use attachEvent (figure it out yourself)
}
function getLink() {
alert(this.href);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.