1
A
回答
1
这是使用jQuery非常简单:
<script>
$(document).ready(function(){
$("a").click(function(){alert($(this).text());});
});
</script>
当然,你可能会想要做的比提醒文字以外的东西。
+3
他想知道如何处理他在firefox扩展中的点击事件而不是在html页面 – 2009-05-20 22:17:57
6
如果你的意思是处理在网页的用户正在浏览的链接点击事件,那么这是如何:
// handle the load event of the window
window.addEventListener("load",Listen,false);
function Listen()
{
gBrowser.addEventListener("DOMContentLoaded",DocumentLoaded,true);
}
// handle the document load event, this is fired whenever a document is loaded in the browser. Then attach an event listener for the click event
function DocumentLoaded(event) {
var doc = event.originalTarget;
doc.addEventListener("click",GetLinkText,true);
}
// handle the click event of the document and check if the clicked element is an anchor element.
function GetLinkText(event) {
if (event.target instanceof HTMLAnchorElement) {
alert(event.target.innerHTML);
}
}
相关问题
- 1. 如何获得全文,即使点击链接以使用硒扩展文本?
- 2. Firefox扩展链接提取器
- 3. Mozilla(Firefox,Thunderbird)扩展名:如何获得扩展名(来自install.rdf)?
- 4. MediaWiki本地扩展链接
- 5. 获得从文本链接
- 6. HREF链接扩展
- 7. Firefox扩展覆盖注入JavaScript文件?
- 8. 使用Firefox扩展JavaScript从
- 9. javascript打开Firefox扩展
- 10. firefox扩展JavaScript存储
- 11. firefox扩展:FireFox 4.0中的链接识别(无href标签)
- 12. 在Chrome扩展中正确链接JavaScript
- 13. 链接numpy扩展
- 14. 重定向不带.html扩展名的链接以链接.html扩展名
- 15. 在HTML中扩展Flash,覆盖Firefox,Chrome,Opera中的文本链接
- 16. 在Firefox扩展中,如何将富文本/链接复制到剪贴板?
- 17. Firefox扩展,访问文档
- 18. 检测Firefox扩展版本
- 19. java从基本接口获得所有扩展接口
- 20. 页面调用Firefox扩展的JavaScript JavaScript
- 21. 获取链接click/javascript/firefox-adon
- 22. Firefox扩展文件结构
- 23. 如何使用Safari扩展附加链接到文本块
- 24. 如何获得扩展的pdf版本
- 25. 从扩展代码本身读取Firefox扩展版本
- 26. 在Firefox扩展
- 27. 链接文件扩展名更正
- 28. Firefox扩展和nsIMutationObserver
- 29. Ruby扩展链接错误
- 30. ExpandableListView centains链接不扩展
通过“周围的链接文本”,你的意思是开之间的文本关闭标签? – ahockley 2009-05-20 22:10:35
实际上意味着整个段落,但即使在标签之间的文本将是好的 – Lilz 2009-05-21 00:46:23