Web Effects JS Right click Pop-up shortcut menu code

Source: Internet
Author: User
Tags visibility
Tip: You can modify some of the code before running

Web Effects JS Right-click Pop-up shortcut menu code <style> skin0 {position:absolute; text-align:left; width:200px; border:2px solid black; Backgro Und-color:menu; Font-family:verdana; line-height:20px; Cursor:default; Visibility:hidden; }. skin1 {cursor:default; position:absolute; text-align:left; font-family:arial, Helvetica, Sans-serif; font-size:10pt ; width:120px; Background-color:menu; Visibility:hidden; border:2px outset buttonhighlight;; Font-style:normal; Font-variant:normal; Font-weight:normal}. MenuItems {padding-left:15px; padding-right:10px;} </style> <script language= "JavaScript" > var Menuskin = "Skin1";<!--menu display style--> var display_url = 1;< !--flag bit--> function showmenuie5 () {var Rightedge = document.body.clientwidth-event.clientx;<!-- According to the mouse position to get the right edge of the menu--> var bottomedge = document.body.clientheight-event.clienty;<!--According to the mouse position to get the bottom boundary of the menu--> if ( Rightedge < Ie5menu.offsetwidth) <!--If the right border exceeds the current window--> ie5menu.style.left = document.body.scrollLeft + Event.clientx -Ie5menu.offsetwidth; else<!--If the right boundary--> ie5menu.style.left = Document.body.scrollLeft + event.clientx;< inside the current window!--set the left border of the menu--> if (Bottomedge < Ie5menu.offsetheight) <!--if the bottom border exceeds the current window--> ie5menu.style.top = Document.body.scrollTop + event.clienty-ie5menu.offsetheight;<!--Set the bottom bounds of the menu--> else<!--If the lower bounds are--> within the current window Ie5menu.style.top = Document.body.scrollTop + event.clienty;<!--set the bottom boundary of the menu--> ie5menu.style.visibility = "visible";<!--display Menu-- > return false; The function hidemenuie5 () {ie5menu.style.visibility = "hidden";<!--set the properties of the menu to hide-->} function highlightie5 () {if ( Event.srcElement.className = = "MenuItems") {Event.srcElement.style.backgroundColor = "highlight";<!--setting background is highlighted-- > event.srcElement.style.color = "White";<!--the font for the--> if (display_url) window.status = Event.srcElement.url; <!--display url-->} function lowlightie5 () in the status bar {<!--remove Background--> if (event.srcElement.className = "MenuItems") ) {Event.srcElement.style.backgroUndcolor = "";<!--set the background color to be empty--> Event.srcElement.style.color = "Black";<!--font is dark--> window.status = ""; <!- -State null-->} function jumptoie5 () {<!--Open a drawn link in a new window--> if (event.srcElement.className = "MenuItems") {<!- -The Object--> if (Event.srcElement.getAttribute ("target")!= null) Window.Open of the event is judged (Event.srcElement.url, Event.srcElement.getAttribute ("target");<!--open the specified link in a new window--> else window.location = Event.srcElement.url; <!--open the specified link in a new Window-->}} </script> <div id= "Ie5menu" class= "Skin0" onmouseover= "highlightie5 ()" Onmouseo Ut= "lowlightie5 ()" onclick= "jumptoie5 ();" > <div class= "MenuItems" url= "http://www.111cn.net" > Sohu </div> <div class= "MenuItems" url= "http://" Www.111cn.net "> Sina </div> <div class=" MenuItems "url=" http://www.111cn.net ">TOM</div> <div class= "MenuItems" url= "http://www.111cn.net" >NBA</div> <div class= "MenuItems" url= "http://" Www.111cn.net ">javascript website </div> <scriptLanguage= "JavaScript" > if (document.all && window.print) {<!--if it is IE browser--> ie5menu.classname = menuskin;<!--get menu style--> Document.oncontextmenu = showmenuie5;<!--declaration Set Function--> = hidemenuie5;<!--declaration settings function-->} </script> <!--This routine implements the right click menu link--> <!--unified style usage--> <!--status bar control-- > <!--function response of mouse events--> <!--use of hyperlinks-->
Tip: You can modify some of the code before running
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.