[英]Mouseover ,Mouseout event not firing in IE
嗨,我有以下HTML布局
<div id="stripe_container" style="top: 0px; border: 1px solid rgb(235, 116, 41);
background: none repeat scroll 0% 0% rgb(243, 232, 151); position: fixed; height: 30px;
width: 100%; left: 0px; z-index: 99999999; font-size: 14px; font-family: Verdana;
cursor: pointer;" class="">
<div id="stripe_rollover" style="height: 30px; background-color: transparent; z-index:
99999999; left: 0px; width: 97%; position: fixed;"></div>
<div id="stripe_text_left" style="margin-top: 5px; margin-left: 15px; color: black;
float: left;">Text Test</div>
<div id="stripe_text_right" style="top: 4px; right: 40px; cursor: pointer; position:
absolute; float: right;">Mouseover</div>
下面是我的js代碼
<script>
var x;
stripe_rollover.onmouseover=function(){
x=document.createElement('div');
x.style.height='30px';
x.style.width='40px';
x.style.backgroundColor='#000000';
var stripe_container=document.getElementById('stripe_container');
stripe_container.parentNode.insertBefore(x,stripe_container.nextSibling);
}
stripe_rollover.onmouseout=function(){
x.parentNode.removeChild(x);
}
Iam在IE瀏覽器中遇到問題。 IE 8,9甚至10。當我將鼠標懸停在strip div上時,將觸發mouseover事件,但是當光標在Mouseover文本上移動時,則不會觸發該事件。
這將解決您的問題( 示例 )
function mouseOver_handler(){
// ...
}
function mouseOut_handler(){
// ...
}
stripe_rollover.onmouseover = mouseOver_handler;
stripe_text_left.onmouseover = mouseOver_handler
stripe_text_right.onmouseover = mouseOver_handler;
stripe_rollover.onmouseout = mouseOut_handler;
stripe_text_left.onmouseout = mouseOut_handler
stripe_text_right.onmouseout = mouseOut_handler;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.