Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
a当您选择它时,该元素不会获得焦点吗?如果是这样,您可以在onfocus
a
onfocus
是的,
您可以使用锚点 onfocus 事件。看:
<a href="#123" onfocus="Test(this);">Test</a>
并且函数“Test”必须读取“href”属性,例如:
function Test(target) { location.href = target.getAttribute('href'); }