Website Development Common Skills Collection (anti-duplication, anti-save, etc.)

Source: Internet
Author: User

1. The right mouse button will be completely shielded

For table

2. Deselect, prevent copying

<body onselectstart= "return false" >

3. No pasting

Onpaste= "return False"

4. Prevent replication

Oncopy= "return false;" oncut= "return false;"

5. Switch to your own icon before the IE address bar

<link rel= "Shortcut Icon" href= "Favicon.ico" >

6. You can display your icon in the Favorites folder

<link rel= "Bookmark" href= "Favicon.ico" >

7. Turn off IME

<input style= "ime-mode:disabled" >

8. Always with frame

<script language= "JavaScript" ><!--if (window = = top) Top.location.href = "frames.htm"; Frames.htm for frames page//--></script>

9. Prevent people from being frame

<script language=javascript><!--if (top.location! = self.location) top.location=self.location; --></script>

10. Web pages will not be saved as

<noscript><iframe src= "/blog/*.html>";</iframe></noscript>

11. View the Web page source code

<input type=button value= View Web page source code onclick= "window.location =" View-source: "+" http://www.baidu.com/"" >

12. Confirm when deleting

<a href= "Javascript:if (" Do you really want to delete it? ") location= "boos.asp?&areyou= Delete &page=1" "> Delete </a>
<a href= "a.aspx?act=del&id=1" onclick= "return confirm (' Confirm delete file? ') ' > Delete </a>

13. Get the absolute position of the control


while (e=e.offsetparent) alert ("top=" +t+ "/nleft=" +l); } </script>


T=document.all.img1.offsettop L=document.all.img1.offsetleft

"Top=" &T&CHR & "left=" &l,64, "get control's position" end function--></script>

14. The cursor is stopped at the end of text in the textbox

<script language= "JavaScript" >function cc () {var e = event.srcelement; var r =e.createtextrange ();

R.collapse (TRUE); R.select (); } </script> <input type=text name=text1 value= "123" onfocus= "CC ()" >

15. Determine the origin of the previous page

<input Type=button value= maximizes onclick=hh2. Click () > <
Input Type=button value= close onclick=hh3. Click () > This example applies to IE

17. Shielding function Key Shift,alt,ctrl

<script>function Look () {if (Event.shiftkey) alert ("Suppress SHIFT key!");//Can be replaced by Alt CTRL} Document.onkeydown=look; </script>

18. Web pages are not cached

19. How do I make the form feel less bump?

<input type=text style= "border:1 solid #000000" > or
<input type=text style= "Border-left:none; Border-right:none; Border-top:none; Border-bottom:1 Solid #000000 "></textarea>

The difference between 20.<div><span>&<layer>? <div> (division) is used to define a large segment of the page element, will generate a career change <span> used to define the elements within the same line, and <div> the only difference is not to generate a career change <layer> is the NS mark, IE does not support , equivalent to <div>

21. Make the pop-up window always on top:

<body onblur= "This.focus (); >

22. Do not scroll bars? Let the vertical bar not:

<body style= "Overflow:scroll;overflow-y:hidden" > </body>

Let the bars not:

<body style= "Overflow:scroll;overflow-x:hidden" > </body>

Two of them all removed? More simple.

<body scroll= "No" > </body>

23. How do I remove the dotted line around the image when I click the image link?

<a href= "#" onfocus= "This.blur ()" ></a>

24. Email Processing Submission Form

<form name= "Form1" method= "Post" action= "mailto:****@***.com" enctype= "Text/plain" > <input type=submit> </form>

25. How do I write in the code that refreshes the parent window of the Open child window?

Window.opener.location.reload ()

26. How to set the size of the open page

Where to open the page

<body onload= "Top.moveby (300,200);" >

27. How to add a background image that is not full on the page, the background image does not move when pulling the page


Background-position:center;background-attachment:fixed}</style>

28. Check to see if a string is all made up of numbers


Alert (Checknum ("1232142141")) Alert (Checknum ("123214214A1"))//--></script>

29. Get the size of a window

Document.body.clientWidth; Document.body.clientHeight

30. How to determine if it is a character

if (/[^/x00-/xff]/g.test (s)) alert ("contains Chinese characters"); else alert ("All characters");

31.TEXTAREA Adaptive number of lines of text

<textarea Rows=1 name=s1 cols=27 onpropertychange= "This.style.posheight=this.scrollheight" > </textarea>

32. Date minus number of days equals second date

<script language=javascript>function cc (DD,DADD)


} cc ("12/23/2002", 2) </script>

33. Which radio are selected


34. Scripts never go wrong

<script language= "JavaScript" ><!--Hide function killerrors () {returntrue;} window.onerror = Killerrors; -</SCRIPT>


35.ENTER key to move the cursor to the next input box

<input onkeydown= "if (event.keycode==13) event.keycode=9" >

36. Detect the link speed of a website: add the following code

<body> area: <script language=javascript> tim=1 setinterval ("tim++", +) B=1var autourl=new Array () autourl[ 1]= "http://www.njcatv.net/" autourl[2]= "javacool.3322.net" autourl[3]= "http://www.sina.com.cn/" autourl[4]= "http ://www.nuaa.edu.cn/"autourl[5]=" http://www.cctv.com/"function butt () {document.write (" <form name=autof> ") for (Var i=1;i<autourl.length;i++) document.write ("<input type=text name=txt" +i+ "size=10 value="/blog/test ......> "=" <input type=text name=url "+i+" size=40> = "<input Type=button value=goonclick=window.open ( This.form.url "+i+". Value) ><br/> ") document.write (" <input type=submit value= Refresh ></form> ")} Butt () function auto (URL) elseb++} function run () {for (Var i=1;i<autourl.length;i++) document.write ("

  

37. Various styles of CURSOR Auto: Standard cursor default: Standard arrow hand: Hand cursor wait: Wait cursor text:i cursor Vertical-text: Horizontal i-shape cursor No-drop: Non-dragging cursor not-allowed: none Effect cursor Help:? Assist cursor All-scroll: Triangle direction Mark move: Move Mark Crosshair: Cross Mark E-resize n-resize nw-resize w-resize s-resize se-resize Sw-resi Ze

38. Page entry and Exit Effects entry page <meta http-equiv= "Page-enter" content= "Revealtrans (duration=x, transition=y)" > launch page <meta http-equiv= "Page-exit" content= "Revealtrans (duration=x, transition=y)" > This is some special effects when the page is loaded and paged out. Duration indicates the duration of the effect, in seconds.   Transition indicates which special effect to use, with a value of 1-23:0 rectangle reduced by 1 rectangle enlargement 2 Round narrowing 3 circle widening 4 down to refresh 5 up to the bottom refresh 6 left to right refresh 7 right to left flush 8 Vertical Blinds 9 Horizontal Blinds 10 Dislocation Horizontal Shutter 11 dislocation vertical Shutter 12 point diffusion 13 to the middle of the refresh 14 middle to the left and right to refresh 15 middle to top 16 up to the middle 17 to the left upper 18 right up to left lower 19 left up to the bottom right 20 left down to Top right 21 horizontal bar 22 vertical bar 23 or more 22 kinds of randomly selected one

39. Jump within the specified time

<meta http-equiv=v= "REFRESH" content= "5; Url=http://www.williamlong.info ">


40. Whether the Web page is retrieved <meta name= "ROBOTS" content= "attribute value" > where the property value is "All": The file will be retrieved and the link on the page can be queried; The property value is "None": The file is not retrieved and is not checked The link on the page; The property value is "index": The file will be retrieved; The property value is "Follow": the link on the query page; The property value is "Noindex": The file is not retrieved but can be queried for links; The property value is "nofollow": The file is not retrieved but can be queried for links on the page 。

Maximize window? <script language= "JavaScript" > <!--self.moveto (0,0) Self.resizeto (screen.availwidth,screen.availheight)/ /--> </script>

Fix the problem: because the priority between the layer and the drop-down box is the drop-down box > layer, the above problem occurs because of the priority order when it is displayed. (if several elements are layers, we can set it through the Z-index property of the layer), the solution is to put a higher priority than the drop-down box in the layer (IFRAME), so as to solve this problem! The specific resolution code is as follows:

<div id= "Menu" style= "Position:absolute; Visibility:hidden; top:20px; left:20px; width:100px; height:200px; "> <table> <tr><td>item 1</td></tr> <tr><td>item 2</td></tr > <tr><td>item 3</td></tr> <tr><td>item 4</td></tr> <tr> <td>item 5</td></tr> </table> <iframe src= "/blog/javascript:false" style= "position: Absolute Visibility:inherit; top:0px; left:0px; width:100px; height:200px; Z-index:-1; Filter= ' Progid:DXImageTransform.Microsoft.Alpha (style=0,opacity=0) '; ></iframe> </div>

<a href= "#" onclick= "document.getElementById (' Menu '). style.visibility= ' Visible ' >menu</a>

<form> <select><option>a form Selection list</option></select> </form>

The input box can also be very beautiful. <div align= "center" ><input type= "hidden" name= "Hao" value= "yes" > Outward count: <input name=answer Style= "Color:rgb (255,0,0); Border-left:medium none; Border-right:medium none; Border-top:medium none; border-bottom:1px solid RGB (192,192,192) "> Unanswered questions: <input name=unanswer id=" Unanswer "style=" Color:rgb (255,0,0) ; Border-left:medium none; Border-right:medium none; Border-top:medium none; border-bottom:1px solid RGB (192,192,192) "> <br/> total Score: <input name=score id=" score "style=" Color:rgb ( 255,0,0); Border-left:medium none; Border-right:medium none; Border-top:medium none; border-bottom:1px solid RGB (192,192,192) "> Conclusion: <input name=xgjg id=" XGJG "style=" Color:rgb (255,0,0); Border-left:medium none; Border-right:medium none; Border-top:medium none; border-bottom:1px solid RGB (192,192,192) > <br/> <br/> <input onclick=processform (this.form) style= "Font-family: Song body; Font-size:9pt "Type=button value= View results name=" buttOn "> <input type=" reset "name=" Submit "value=" Redo "> </div> Note: Modify <body> <body onload=" Max. Click () > to open the maximum

Instead of <body onload= "min. Click () > Turn window on to minimize

<object id= "min" type= "Application/x-oleobject" classid= "Clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" > < param name= "Command" value= "Minimize" > </object> <object id= "Max" type= "Application/x-oleobject" classid= "Clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11" > <param name= "Command" value= "maximize" > </object> < /body>

Automatic page Refresh (description)

When you make a Web page, are there times when you want your page to automatically refresh or automatically jump to another page that you set yourself? In fact, it is very simple to achieve this effect, and this effect is not even called special effects. You just have to add the following code to your page.

1, automatic page refresh: Add the following code to the

2, page automatic jump: Add the following code to the

Page Auto-close

5000 means time <body onload= "SetTimeout (Window.close,)" >

Pop-up window closes automatically

Pop-up window automatically closes after 10 seconds

Note: Add <onload= "Closeit ()" to the body of the new tan.htm > head

1 <Scriptlanguage= "JavaScript">2 3 <!--4 5 varGT=unescape ('%3e');6 7 varPopup=NULL;8 9 var Over="Launch Pop-up Navigator";Ten  One Popup=window.open ("', 'Popupnav', 'Width=225,height=235,resizable=1,scrollbars=auto'); A  - if(Popup!=NULL) { -  the if(Popup.opener==NULL) { -  - Popup.opener=Self ; -  + } -  + Popup.location.href='tan.htm'; A  at } -  - // - -  - </Script> <Body>Note: This code is in the new file<Scriptlanguage= "JavaScript"> -  in functionCloseit () -  to </Script>
View Code

Website Development Common Skills Collection (anti-duplication, anti-save, etc.)

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.