Javascript JS:document/window上的mouseout事件
我在Javascript JS:document/window上的mouseout事件,javascript,Javascript,我在窗口/文档对象上添加了mouseout事件侦听器。 我想在将光标移动到页面中的iframe时触发此事件,但它也会在主体中的其他元素上触发 document.addEventListener('mouseout', function(event) { event.stopPropagation() console.log('out') }, true) // not working so I try adding this event to widow window.addEve
窗口
/文档
对象上添加了mouseout
事件侦听器。我想在将光标移动到页面中的iframe时触发此事件,但它也会在主体中的其他元素上触发
document.addEventListener('mouseout', function(event) {
event.stopPropagation()
console.log('out')
}, true)
// not working so I try adding this event to widow
window.addEventListener('mouseout', function(event) {
event.stopPropagation()
console.log('out')
}, true)
// not working too
请帮忙!感谢阅读:)您可以这样注册您的活动:
document.getElementById("sa").contentDocument.addEventListener('mouseout', function(event) {
event.stopPropagation()
console.log('out')
}, true)
但是,如果您的内容是跨域的,则可能会导致权限错误