Practical JavaScript technology-shielding class _javascript skills

Source: Internet
Author: User
Tags delete key
One, screen Keyboard all keys
<script language= "JavaScript" >
<!--
function Document.onkeydown () {
Event.keycode = 0;
Event.returnvalue = false;
}
-->
</script>
Second, shielding the right mouse button
Add Oncontextmenu=self.event.returnvalue=false to the body tag or:
<script language= "JavaScript" >
<!--
function Document.oncontextmenu ()
{
return false;
}
-->
</script>
function Nocontextmenu ()
{
if (document.all) {
Event.cancelbubble=true;
Event.returnvalue=false;
return false;
}
}
Or:
<body onmousedown= "Rclick ()" oncontextmenu= "Nocontextmenu ()" >
<script language= "JavaScript" >
<!--
function Rclick ()
{
if (document.all) {
if (Event.button = = 2) {
Event.returnvalue=false;
}
}
}
-->
</script>
Third, shielding CTRL + N, SHIFT+F10, F5 refresh, backspace key
<script language= "JavaScript" >
<!--
Screen the right mouse button, CTRL + N, SHIFT+F10, F5 refresh, backspace key
function Window.onhelp () {return false}//Shield F1 Help
function KeyDown () {
if ((Window.event.altKey) &&
((window.event.keycode==37) | |//Shielding ALT + Direction key ←
(window.event.keycode==39))) {//Shielding ALT + Direction key →
Alert ("You are not allowed to use ALT + arrow keys forward or back page!") ");
Event.returnvalue=false;
}
Note: This is not really shielding ALT + direction key, because ALT + arrow pop-up warning box, hold down the ALT key, with the mouse point off the warning box, this
The shielding method is ineffective.
if ((Event.keycode = 8) &&
(Event.srcElement.type!= "text" &&
Event.srcElement.type!= "textarea" &&
Event.srcElement.type!= "password") | | Mask BACKSPACE Delete key
(event.keycode==116) | | Mask F5 Refresh Key
(Event.ctrlkey && event.keycode==82)) {//ctrl + R
event.keycode=0;
Event.returnvalue=false;
}
if ((Event.ctrlkey) && (event.keycode==78))//Shield CTRL + N
Event.returnvalue=false;
if ((Event.shiftkey) && (event.keycode==121))//Shielding SHIFT+F10
Event.returnvalue=false;
if (Window.event.srcElement.tagName = "A" && Window.event.shiftKey)
Window.event.returnvalue = false; Screen shift plus left mouse button new page open
if ((Window.event.altKey) && (window.event.keycode==115)) {//Shield ALT+F4
Window.showmodelessdialog ("About:blank", "" "," dialogwidth:1px;dialogheight:1px ");
return false;}
}
In addition, you can use the Window.Open method to screen IE's all menus
The first method:
window.open ("Your. htm", "", "Toolbar=no,location=no,directories=no,menubar=no,
Scrollbars=no,resizable=yes,status=no,top=0,left=0 ")
The second way is to open a Full-screen page:
window.open ("Your. asp", "", "Fullscreen=yes")
*/
-->
</script>
Four, screen browser in the upper right corner, "Minimize" "" "" Off "key
<script language=javascript>
function Window.onbeforeunload ()
{
if (event.clientx>document.body.clientwidth&&event.clienty<0| | Event.altkey)
{
Window.event.returnvalue = "";
}
}
</script>
or open the page with full screen
<script language= "JavaScript" >
<!--
window.open (www.32pic.com, "32pic", "fullscreen=3,height=100, width=400,
Top=0, Left=0, Toolbar=no, Menubar=no, Scrollbars=no, Resizable=no,location=no,
Status=no ");
-->
</script>
Note: Add in the body tag
Onbeforeunload= "Javascript:return false"//so that Windows cannot be closed
Five, shielding F5 key
<script language= "JavaScript" >
<!--
function Document.onkeydown ()
{
if (event.keycode==116)
{
Event.keycode = 0;
Event.cancelbubble = true;
return false;
}
}
-->
</script>
Six, screen IE back button
Use when you link to
<a href= "javascript:location.replace (URL)" >
Seven, screen main window scroll bar
Add it to the body tag.
Style= "Overflow-y:hidden"
Eight, shielding screen, constantly emptying the clipboard
Add it to the body tag.
Onload= "SetInterval (' Clipboarddata.setdata" (\ ' text\ ', \ ' \ ') ', 100) '
Nine, the screen printing function of the website
<style>
@media Print {
* {Display:none}
}
</style>
Ten, shielding IE6.0 picture on the automatic appearance of the Save icon
Method One:
<meta http-equiv= "Imagetoolbar" content= "no" >
Method Two:

Xi. all script in the screen page
<noscrript></noscript>
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.