Summary of Internet page Browsing restriction implementation

Source: Internet
Author: User
Tags add date empty lowercase return string window
Internet | page | page

1. text box Input Restrictions

Implementation limit input large, lowercase English, digital, floating-point decimal, date, Chinese, some English, some Chinese and many other functions. Add it directly to the HTML code to use it.


lowercase English:

Onpaste = "Return Reginput (this,/^[a-z]*$/, Window.clipboardData.getData (' Text ')")

OnDrop = "Return Reginput (this,/^[a-z]*$/, Event.dataTransfer.getData (' Text ')")

Style= "Ime-mode:disabled"

>

Capital English:

Onpaste = "Return Reginput (this,/^[a-z]*$/, Window.clipboardData.getData (' Text ')")

OnDrop = "Return Reginput (this,/^[a-z]*$/, Event.dataTransfer.getData (' Text ')")

style= "Ime-mode:disabled" >



Any number:

Onpaste = "Return Reginput (this,/^[0-9]*$/, Window.clipboardData.getData (' Text ')")

OnDrop = "Return Reginput (this,/^[0-9]*$/, Event.dataTransfer.getData (' Text ')")

Style= "Ime-mode:disabled"

>

Limited to 2 decimal places:

Onpaste = "Return Reginput" (this,/^\d*\.? \d{0,2}$/, Window.clipboardData.getData (' Text ')) "

OnDrop = "Return Reginput" (this,/^\d*\.? \d{0,2}$/, Event.dataTransfer.getData (' Text ')) "

Style= "Ime-mode:disabled"

> such as: 123.12


Date:

String.fromCharCode (Event.keycode)) "

Onpaste = "Return Reginput" (This,/^\d{1,4} ([-\/] (\d{1,2} ([-\/] (\d{1,2})?)? $/,
Window.clipboardData.getData (' Text ')) "

OnDrop = "Return Reginput" (This,/^\d{1,4} ([-\/] (\d{1,2} ([-\/] (\d{1,2})?)? $/,
Event.dataTransfer.getData (' Text ')) "

Style= "Ime-mode:disabled"

> such as: 2002-9-29

Any Chinese:

Onpaste = "Return Reginput (this,/^[\u4e00-\u9fa5]*$/, Window.clipboardData.getData (' Text ')")

OnDrop = "Return Reginput (this,/^[\u4e00-\u9fa5]*$/, Event.dataTransfer.getData (' Text ')")

>

Part English:

Onpaste = "Return Reginput (this,/^[a-e]*$/, Window.clipboardData.getData (' Text ')")

OnDrop = "Return Reginput (this,/^[a-e]*$/, Event.dataTransfer.getData (' Text ')")

Style= "Ime-mode:disabled"

> Scope: a,b,c,d,e

Part Chinese:


Onpaste = "Return Reginput (this,/^[1,234,567,890]*$/, Window.clipboardData.getData (' Text ')")

OnDrop = "Return Reginput (this,/^[1,234,567,890]*$/, Event.dataTransfer.getData (' Text ')")

> Scope: 1,234,567,890


2. Can not expand the right button, can not select all, can not replicate the implementation

Onkeypress= "Window.event.returnvalue=false"

onkeyup= "Window.event.returnvalue=false"

Ondragstart= "Window.event.returnvalue=false"

onselectstart= "Event.returnvalue=false" >
...


3. Prevent page body content from being selected
Onselectstart = "return false" onselect= "Document.selection.empty ()"
Oncopy= "Document.selection.empty ()" Onbeforecopy= "return

False ">


4. Avoid others to put the Web page in the frame


5. Forbidden to view source code


6. Close the Input method


7. Prohibit picture downloading
At the end of here add:
Oncontextmenu= ' return false ' ondragstart= ' return false ' onselectstart= ' return
False "scroll=" Auto "


8. Prohibit caching
Add in head:





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.