<!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=gb2312" /> <title>javascript div mouseout-hidden-zone</title> <script> if(typeof(HTMLElement)!="undefined") { HTMLElement.prototype.contains=function(obj) { while(obj!=null&&typeof(obj.tagName)!="undefind"){ if(obj==this) return true; obj=obj.parentNode; } return false; }; } function hideDiv(e,o){ var o=o; if(!e)var e=e||window.event; var relTarg=e.relatedTarget||e.toElement; if ((relTarg!=null)){ if (o.contains(relTarg)) { return; } o.style.display='none'; } } function showDiv(o){ o.style.display='block' } </script> <style> #test{ margin:0 auto; background-color:#999999; width:200px; height:300px; } </style> </head> <body> <div id="test" style="" onmouseover="showDiv(this)" onmouseout="hideDiv(event,this)"> <select> <option>aaa</option> <option>bbb</option> <option>ccc</option> <option>ddd</option> </select> </div> </body> </html>
提示:你可以先修改部分代码再运行。
用户名:
密 码:
记住密码