»
Tiếng AnhTiếng PhápTiếng Việt

In - Menu chuột phải - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Trình đơn » Trình đơn chuột phải » Menu chuột phải
URL: https://www.javascriptbank.com/right-click-menu.html

Menu chuột phải © JavaScriptBank.comMột đoạn mã JavaScript khác để tạo trình đơn trên trang web với sự kiện nhấn phải chuột.

Phiên bản đầy đủ: jsB@nk » Trình đơn » Trình đơn chuột phải » Menu chuột phải
URL: https://www.javascriptbank.com/right-click-menu.html



CSS
<STYLE>#menu {BACKGROUND-COLOR: menu; BORDER-BOTTOM: black 2px solid; BORDER-LEFT: black 2px solid; BORDER-RIGHT: black 2px solid; BORDER-TOP: black 2px solid; CURSOR: default; FONT-FAMILY: Verdana; LINE-HEIGHT: 20px; POSITION: absolute; VISIBILITY: hidden; WIDTH: 125px}.menuitems {PADDING-LEFT: 15px; PADDING-RIGHT: 15px}</STYLE><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<SCRIPT language=JavaScript1.2>//set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status barvar display_url=1function showmenu(){var rightedge=document.body.clientWidth-event.clientXvar bottomedge=document.body.clientHeight-event.clientYif (rightedge<menu.offsetWidth)menu.style.left=document.body.scrollLeft+event.clientX-menu.offsetWidthelsemenu.style.left=document.body.scrollLeft+event.clientXif (bottomedge<menu.offsetHeight)menu.style.top=document.body.scrollTop+event.clientY-menu.offsetHeightelsemenu.style.top=document.body.scrollTop+event.clientYmenu.style.visibility="visible"return false}function hidemenu(){menu.style.visibility="hidden"}function over(){if (event.srcElement.className=="menuitems"){event.srcElement.style.backgroundColor="highlight"event.srcElement.style.color="yellow"if (display_url==1)window.status=event.srcElement.url}}function out(){if (event.srcElement.className=="menuitems"){event.srcElement.style.backgroundColor=""event.srcElement.style.color="black"window.status=''}}function linkTo(){if (event.srcElement.className=="menuitems")window.location=event.srcElement.url}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<DIV id=menu onclick=linkTo() onmouseout=out() onmouseover=over()><DIV class=menuitems url="http://JavaScriptBank.com">JavaScriptBank.com</DIV><DIV class=menuitems url="http://JavaScriptBank.com">JavaScriptBank.com</DIV><DIV class=menuitems url="http://JavaScriptBank.com">JavaScriptBank.com</DIV><DIV class=menuitems url="http://JavaScriptBank.com">JavaScriptBank.com</DIV><DIV class=menuitems url="http://JavaScriptBank.com">JavaScriptBank.com</DIV><HR><DIV class=menuitems url="mailto:[email protected]">Email Me!</DIV></DIV><SCRIPT language=JavaScript1.2>document.oncontextmenu=showmenuif (document.all&&window.print)document.body.onclick=hidemenu</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->