To remove the right mouse button in a Web page Daquan

Source: Internet
Author: User
Tags visibility window
Mouse | web | right button The first: the Dumbest way
Add the following code between <script language=javascript>
function Click () {
if (event.button==2) {
Alert (' Web teaching Network http://www.webjx.com ')
}
}
Document.onmousedown=click
</SCRIPT>

Second: Add to Favorites
<script language=javascript><!--
function Click () {
if (event.button==2) {window.external.addFavorite (' http://www.webjx.com ', ' Web Teaching Network ')}}
Document.onmousedown=click
--></script>

The third type: Make the right mouse button no response, others think their mouse is broken!
Change the <BODY> into <body oncontextmenu=self.event.returnvalue=false>

Fourth: The smartest way to customize the mouse's right menu, to give visitors a new feeling!
Step One: Add code to <style>
<!--
#ie5menu {
Position:absolute;
width:200px;
BORDER:2PX solid black;
Background-color:menu;
Font-family:verdana;
line-height:20px;
Cursor:default;
Visibility:hidden;
}
. menuitems{
padding-left:15px;
padding-right:15px;
}
-->
</style>
<script language= "JavaScript1.2" >
Status bar
var display_url=0
function Showmenuie5 () {
var rightedge=document.body.clientwidth-event.clientx
var bottomedge=document.body.clientheight-event.clienty
if (rightedge<ie5menu.offsetwidth)
Ie5menu.style.left=document.body.scrollleft+event.clientx-ie5menu.offsetwidth
Else
Ie5menu.style.left=document.body.scrollleft+event.clientx
if (bottomedge>ie5menu.offsetheight)
Ie5menu.style.top=document.body.scrolltop+event.clienty-ie5menu.offsetheight
Else
Ie5menu.style.top=document.body.scrolltop+event.clienty
ie5menu.style.visibility= "Visible"
return False
}
function Hidemenuie5 () {
Ie5menu.style.visibility= "Hidden"
}
function Highlightie5 () {
if (event.srcelement.classname== "MenuItems") {
Event.srcelement.style.backgroundcolor= "Highlight"
Event.srcelement.style.color= "White"
if (display_url==1)
Window.status=event.srcelement.url
}
}
function Lowlightie5 () {
if (event.srcelement.classname== "MenuItems") {
Event.srcelement.style.backgroundcolor= ""
Event.srcelement.style.color= "BLACK"
Window.status= '
}
}
function Jumptoie5 () {
if (event.srcelement.classname== "MenuItems")
Window.location=event.srcelement.url
}
</script>
Step Two: Add the following code to <body> and </body>
<!--[If ie]>
<div id= "Ie5menu"
>
<div class= "MenuItems" url= "http://www.webjx.com" > Home </div>
<div class= "MenuItems"
Url= "http://www.webjx.com/bbs/" > Web Teaching Network Technology Forum </div>
<div class= "MenuItems" url= "http://www.webjx.com/sucai/" > Boutique material </div>
<div class= "MenuItems"
Url= "Http://www.webjx.com/flash" > Fine animation </div>
<div class= "MenuItems"
Url= "http://www.webjx.com/web/" > Web page Making </div>
<div class= "MenuItems" url= "http://www.webjx.com/" > Web Teaching Network </div>
</div>
<! [endif]-->
<script language= "JavaScript1.2" >
Document.oncontextmenu=showmenuie5
if (document.all&&window.print)
Document.body.onclick=hidemenuie5
</script>

The above information is my own collection accumulated, and now take out to share with you, there is a better way not to forget to notify me! Of course, you also can not cancel the right mouse button, it depends on your own needs!

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.