cat m2.jsfunction popMenu(event){ var mymenu = document.getElementById('menu-div'); mymenu.style.left = event.clientX + "px"; mymenu.style.top = event.clientY + "px"; mymenu.style.display = 'block'; return false;}cat m2.css#menu-div{ width:140px; height:200px; background-color:#00beff; position:fixed; display:none; border:2px solid red;}li{ margin-left:-10px; line-height:35px;}html代码<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>鼠标的用途</title> <link rel="stylesheet" href="m2.css"> <script src="m2.js"></script></head><body> <p onmouseover="popMenu();">你好</p> <div id="menu-div"> <ul> <li>这是菜单项1</li> <li>这是菜单项2</li> <li>这是菜单项3</li> <li>这是菜单项4</li> <li>这是菜单项5</li> </ul> </div></body></html>为何鼠标放在 你好 这个字上面的时候,没有菜单弹出?如何修改?
添加回答
举报
0/150
提交
取消