为了账号安全,请及时绑定邮箱和手机立即绑定

ul nomouseout ?

ul nomouseout ?

咕咕问 2016-02-22 16:54:42
通过document.getElementById()获取到了ul,然后通过ul.onmouseout设置了alert();但是只要我的鼠标从ul进入到ul借点内的li中,就alert了。下面是代码<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><style type="text/css">li{ float:left; /* 注意 li的position必须设置为relative或者absolute */ position:relative; list-style-type:none; width:117px; line-height:33px; color:blue; background-color:red;}ul{ background-color:yellow; width:800px; height:300px; padding:0px; margin:0px;}</style><body><ul>                <li><div>协会活动</div></li>                <li><div>基地劳动</div></li>                <li><div>募捐方法</div></li>                <li><div>账目明细</div></li>            </ul>            <script type="text/javascript"> ul = document.getElementsByTagName("ul")[0]; ul.onmouseout = function(e){ e = e || window.event; if(e.stopPropagation){ e.stopPropagation(); }else{ e.cancelBubble(); } alert(); }</script>            </body></html>
查看完整描述

1 回答

  • 1 回答
  • 1 关注
  • 1277 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信