Home >Web Front-end >JS Tutorial >Javascript can easily make the pop-up submenu automatically disappear when the mouse is moved away_javascript skills

Javascript can easily make the pop-up submenu automatically disappear when the mouse is moved away_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:06:301353browse
复制代码 代码如下:







<SCRIPT> <br>var cm=null; <br>document.onclick = new Function("show(null)") <br>function getPos(el,sprop) <br>{var iPos = 0 <br>while (el!=null) <br>{iPos =el["offset" sprop] <br>el = el.offsetParent} <br>return iPos} <br>function show(el,m) <br>{if (m) { m.style.display=''; <br>m.style.pixelLeft = getPos(el,"Left") <br>m.style.pixelTop = getPos(el,"Top") el.offsetHeight} <br>if ((m!=cm) && (cm)) cm.style.display='none';cm=m} <br></SCRIPT>














Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn