<script type="text/javascript">?window.onload = function (){ var oMenu = document.getElementById("menu"); var aLi = oMenu.getElementsByTagName("li"); //加載后隱藏自定義右鍵菜單 oMenu.style.display = "none"; //菜單鼠標移入/移出樣式 for (i = 0; i < aLi.length; i++) { //鼠標移入樣式 aLi[i].onmouseover = function () { this.className = "active" }; //鼠標移出樣式 aLi[i].onmouseout = function () { this.className = "" } } //自定義菜單 document.oncontextmenu = function (event) { var event = event || window.event; var style = oMenu.style; style.display = "block"; style.top = event.clientY + "px"; style.left = event.clientX + "px"; return false; }; //頁面點擊后自定義菜單消失 document.onclick = function () { oMenu.style.display = "none" }};</script>
js模擬桌面右鍵菜單,粘貼復制功能。如果有更好的辦法也可以
櫻桃小丸子_0002
2016-03-29 18:04:54