简单快速的问题....
我有以下链接 html:
<a href="http://www.site.com/" onmouseover="" />
我有一个 javascript 函数,我想在该链接中动态输入一些 onmouseover 信息。因此,如果调用此 javascript 函数,那么假设它变成这样:
<a href="http://www.site.com/" onmouseover="alert('howdy')" />
有什么办法吗?
最佳答案
添加name属性并赋值onmouseover
<a href="http://www.site.com/" onmouseover="" name="xxx"/>
document.getelementsbyname('xxx').onmouseover = function() { alert('howdy') }
关于javascript - 通过javascript将鼠标悬停添加到链接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4873582/