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.
在一个函数中,与另一个项目无关,如何在 id 为“项目”的 div 上触发 javascript 中的 onmouseover 事件?
只需调用该onmouseover元素的函数:
onmouseover
document.getElementById("item").onmouseover()
document.getElementById("item")指向元素,指向鼠标悬停事件的函数并附加到它会调用该函数。elem.onmouseover()
document.getElementById("item")
elem
.onmouseover
()