This article describes the implementation method of JavaScript custom right-click pop-up menu. Share it for your reference. The specific implementation method is as follows:
<head runat="server"> <title>Untitled page</title> <script type="text/javascript"> var oPopup = (); function PopMenu(id) { var oPopBody = ; = "buttonface"; = "solid black 1px"; var TableBegin="<table style=\"border: 0; width: 100%; font-size: 12px;\" cellpadding=\"0\" cellspacing=\"0\">"; var Tr1="<tr><td valign=\"middle\" style=\"height: 20px;\" onmousemove=\"='highlight';='highlighttext'\" onmouseout=\"='';=''\" onclick=\"('/news/?');\">View the news</td></tr>"; var TrBr1="<tr><td style=\"background-color: ThreeDShadow; height: 1px;\"></td></tr>"; var Tr2="<tr><td valign=\"middle\" style=\"height: 20px;cursor:hand;\" onmousemove=\"='highlight';='highlighttext'\" onmouseout=\"='';=''\" onclick=\"['main'].location='?;'\">View the news</td></tr>"; var TableEnd="</table>"; =TableBegin+Tr1+TrBr1+Tr2+TableEnd; (, , 90, 41, ); return false; } </script> </head> <body> <form runat="server"> <div> <a href='javascript:void(0);' oncontextmenu='PopMenu(1);return false;'> <img alt="" src='' style="border:0;width:150px;height:110px; cursor:hand"/> <br/> </a> <iframe name="main" frameborder="0" width="100%" scrolling="auto" height="100%"> </iframe> </div> </form> </body> </html>
I hope this article will be helpful to everyone's JavaScript programming.