1. oncontextmenu = "window. event. returnvalue = false" will completely block the right mouse button
<Table border oncontextmenu = return (false)> <TD> NO </table>
2. <body onselectstart = "Return false"> cancel selection to prevent Replication
3. onpaste = "Return false" Do not paste
4. oncopy = "Return false;" oncut = "Return false;" Prevent Replication
5. <LINK rel = "shortcut icon" href = "favicon. ICO"> replace it with your own icon in front of the IE Address Bar
6. <LINK rel = "bookmark" href = "favicon. ICO"> your Icons can be displayed in favorites.
7. <input style = "ime-mode: Disabled"> disable the input method.
8. Always carry the framework
<Script language = "JavaScript"> <! --
If (window = Top) top. Location. href = "frames.htm"; // frames.htm is the frame webpage.
// --> </SCRIPT>
9. Prevent Frame
<Script language = JavaScript> <! --
If (top. location! = Self. Location) top. Location = self. location;
// --> </SCRIPT>
10. The webpage cannot be saved
<NoScript> <IFRAME src = *. html> </iframe> </NoScript>
11. <input type = button value = view webpage source code
Onclick = "window. Location =" view-source: "+" http://www.pconline.com.cn "">
12. Confirm deletion
<A href = "javascript: If (confirm (" are you sure you want to delete it? ") Location =" boos. asp? & Areyou = Delete & page = 1 "> Delete </a>
13. Obtain the absolute position of the control
// Javascript
<Script language = "JavaScript">
Function getie (e ){
VaR T = E. offsettop;
VaR L = E. offsetleft;
While (E = E. offsetparent ){
T + = E. offsettop;
L + = E. offsetleft;
}
Alert ("Top =" + T + "/nleft =" + l );
}
</SCRIPT>
// VBScript
<Script language = "VBScript"> <! --
Function getie ()
Dim t, L, A, B
Set a = Document. All. img1
T = Document. All. img1.offsettop
L = Document. All. img1.offsetleft
While a. tagname <> "body"
Set a = A. offsetparent
T = T + A. offsettop
L = L + A. offsetleft
Wend
Msgbox "Top =" & T & CHR (13) & "Left =" & L, 64, "Get control position"
End Function
--> </SCRIPT>
14. The cursor stops at the end of the text box.
<Script language = "JavaScript">
Function CC ()
{
VaR E = event. srcelement;
VaR r = E. createTextRange ();
R. movestart ("character", E. value. Length );
R. Collapse (true );
R. Select ();
}
</SCRIPT>
<Input type = text name = text1 value = "123" onfocus = "CC ()">
15. determine the source of the previous page
Javascript:
Document. referrer
16. Minimize, maximize, and close the window
<Object ID = HH1 classid = "CLSID: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<Param name = "command" value = "minimize"> </Object>
<Object ID = HH2 classid = "CLSID: ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<Param name = "command" value = "maximize"> </Object>
<Object ID = hh3 classid = "CLSID: adb880a6-d8ff-11cf-9377-00aa003b7a11">
<Param name = "command" value = "close"> </Object>
<Input type = button value = minimized onclick = hh1.click ()>
<Input type = button value = maximized onclick = hh2.click ()>
<Input type = button value = Disable onclick = hh3.click ()>
This example applies to IE
17. Block function keys shift, ALT, CTRL
<SCRIPT>
Function look (){
If (event. shiftkey)
Alert ("do not press shift! "); // You can change it to alt CTRL
}
Document. onkeydown = look;
</SCRIPT>
18. The webpage will not be cached
<Meta HTTP-EQUIV = "Pragma" content = "no-Cache">
<Meta HTTP-EQUIV = "cache-control" content = "no-cache, must-revalidate">
<Meta HTTP-EQUIV = "expires" content = "wed, 26 Feb 1997 08:21:57 GMT">
Or <meta HTTP-EQUIV = "expires" content = "0">
19. How to Make the form feel free of attention?
<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>
20. What are the differences between <div> <span> & <layer>?
<Div> (Division) is used to define the page elements of a large segment, and a line is generated.
<Span> is used to define elements in the same row. The only difference between <div> and <div> is that no transpose is generated.
<Layer> is the NS tag, which is not supported by IE, which is equivalent to <div>