2010-11-17 74 views
0

我已经做了contentscript其中“注入”到下列网站:链接功能,而不是网站

< a href="somewebsite.html">mytext< /a> 

我面临的问题是,我想在我的铬链接功能而不是扩展。就像:

< a href="mychromeextensionfunction">mytext< /a>. 

我该如何设法做到这一点,甚至有可能链接到铬扩展功能?

回答

0

你不能通过href属性来做到这一点;您需要onClick属性。

0

这解释了它,为把我在正确的方向感谢:)

这里是你如何能做到这一点的样本代码。

link_dom.onclick = function(evt){ alert('hello'); }