JavaScript Screen Keyboard Common code

Source: Internet
Author: User

Use when you link to

<a href= "Web effects:
Location.replace (URL) ">
JavaScript Mask main Window scroll bar

Add it to the body tag.
Style= "Overflow-y:hidden"
JavaScript screen screen, constantly emptying clipboard
Add it to the body tag.
Onload= "SetInterval (' Clipboarddata.setdata (' Text ', ') ', 100)"
The printing function of JavaScript masking website
<style>
@media Print {
* {Display:none}
}
</style>

JavaScript mask IE6.0 Save icon automatically appears on a picture
Method One:

<meta http-equiv= "Imagetoolbar" content= "no" >

Method Two:


All script in the JavaScript mask page
<noscrript></noscript>


JavaScript Mask F5 Key
The code is as follows

<script language= "JavaScript" >
<!--
function Document.onkeydown ()
{
if (event.keycode==116)
{
Event.keycode = 0;
Event.cancelbubble = true;
return false;
}
}
-->
</script>

Screen browser in the upper right corner, minimize, maximize, close 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.zutiai.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 onbeforeunload= "Javascript:return false" to the body tag (so that the window cannot be closed)


The JavaScript code that implements all keys for the screen keyboard is as follows:

<script language= "JavaScript" >
<!--
function Document.onkeydown () {
Event.keycode = 0;
Event.returnvalue = false;
}
-->
</script>


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 shielding method is ineffective.

if ((Event.keycode = 8) &&
(event.srcElement.type!= "text" &&
Event.srceleme Nt.type!= "textarea" &&
Event.srcElement.type!= "password") | | Mask backspace Delete key
(event.keycode==116) | |//Shielding F5 Refresh key
(Event.ctrlkey && event.keycode==82)) {//ctrl + R
event. keycode=0;
Event.returnvalue=false;
}
if ((Event.ctrlkey) && (event.keycode==78))//Mask 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;//Mask Shift Plus left mouse button new page
if ((Window.event.altKey) && (window.event.keycode==115)) {//Mask 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 tutorial", "", "Fullscreen=yes")

JavaScript Mask right mouse button can also be added to the body tag oncontextmenu=

Self.event.returnvalue=false

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>
In addition


Oncontextmenu= "Window.event.returnvalue=false" will completely mask the right mouse button
<table border Oncontextmenu=return (false) ><td>no</table>
Available for table

<body onselectstart= "return false" > deselect, Prevent replication

Oncopy= ' return false; ' oncut= ' return false; ' Prevent replication


JavaScript block keyword, presumably the idea is to use JavaScript to replace the existing text, to achieve the purpose of replacement <script

language= "javascript1.2" >
function Test () {
if ((A.b.value.indexof ("* *") = = 0) | | (A.b.value.indexof ("* * *") = = 0)) {
Alert (":)");
A.b.focus ();
return false;}
}
</script>
<form name=a onsubmit= "return Test ()" >
<input Type=text name=b>
<input type= "Submit" name= "Submit" value= "Check" >
</form>

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.