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 = ""> <! --
If (window = Top) top. Location. href = "frames.htm"; // frames.htm is the frame webpage.
// --> </SCRIPT>
9. Prevent Frame
<Script language => <! --
If (top. location! = Self. Location) top. Location = self. location;
// --> </SCRIPT>
10. The webpage cannot be saved
<NoScript> <IFRAME src = "/blog/*. html>"; </iframe> </NoScript>
11. <input type = button value = view webpage source code
Onclick = "window. Location =" view-source: "+" http://www.williamlong.info "">
12. Confirm deletion
<A xx = 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
//
<Script language = "">
Function getie (e ){
VaR T = E. offsettop;
VaR L = E. offsetleft;
While (E = E. offsetparent)
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 = "">
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
:
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>
21. Make the pop-up window always on the top:
<Body onblur = "This. Focus ();">
22. Do not use a scroll bar?
Make the vertical bar not:
<Body style = "overflow: Scroll; overflow-Y: hidden">
</Body>
Make the horizontal bar unavailable:
<Body style = "overflow: Scroll; overflow-X: hidden">
</Body>
Remove both of them? Simpler
<Body scroll = "no">
</Body>
23. How do I remove the dotted line around the image after clicking 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 to refresh the code of the parent window in the opened Child Window?
Window. opener. Location. Reload ()
26. How to set the page size
<Body onload = "Top. resizeTo (300,200);">
<Body onload = "Top. moveBy (300,200);">
27. How to add a background image that is not full? The background image does not move when pulling the page
<Style>
Body
{Background-image: URL (/blog/logo.gif); background-repeat: No-Repeat;
Background-position: center; Background-Attachment: Fixed}
</Style>
28. check whether a string is composed of digits.
<Script language = ""> <! --
Function checknum (STR) {return Str. Match (// D/) = NULL}
Alert (checknum ("1232142141 "))
Alert (checknum ("123214214a1 "))
// --> </SCRIPT>
29. Get the size of a window
Document. Body. clientwidth; document. Body. clientheight
30. How to determine whether it is a character
If (/[^/x00-/xFF]/g. test (s) Alert ("containing Chinese characters ");
Else alert ("All characters ");
31. Number of lines of textarea adaptive text
<Textarea rows = 1 name = S1 Cols = 27 onpropertychange = "This. style. posheight = This. scrollheight">
</Textarea>
32. The date minus the number of days equals to the second date
<Script language =>
Function CC (DD, dadd)
{
// Add error handling.
VaR A = new date (dd)
A = A. valueof ()
A = A-dadd * 24x60*60*1000
A = new date ()
Alert (A. getfullyear () + "year" + (A. getmonth () + 1) + "month" + A. getdate () + "day ")
}
CC ("12/23/2002", 2)
</SCRIPT>
33. Which radio is selected
<HTML> <script language = "VBScript">
Function checkme ()
For each ob in radio1
If OB. Checked then window. alert OB. Value
Next
End Function
</SCRIPT> <body>
<Input name = "radio1" type = "radio" value = "style" Checked> Style
<Input name = "radio1" type = "radio" value = "barcode"> Barcode
<Input type = "button" value = "check" onclick = "checkme ()">
</Body>
34. Script never fails
<Script language = "">
<! -- Hide
Function killerrors (){
Return true;
}
Window. onerror = killerrors;
// -->
</SCRIPT>
35. Press enter to move the cursor to the next input box.
<Input onkeydown = "If (event. keycode = 13) event. keycode = 9">
36. Check the link speed of a Website:
Add the following code to the <body> area:
<Script language =>
Tim = 1
Setinterval ("Tim + +", 100)
B = 1
VaR autourl = new array ()
Autourl [1] = "www.njcatv.net"
Autourl [2] = "javacool.3322.net"
Autourl [3] = "www.sina.com.cn"
Autourl [4] = "www.nuaa.edu.cn"
Autourl [5] = "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/testing...> "=" <input type = text
Name = URL "+ I +" size = 40 >=" <input type = button value = go
Onclick = Window. Open (this. Form. url "+ I +". Value)> <br/> ")
Document. Write ("<input type = submit value = Refresh> </form> ")
}
Butt ()
Function auto (URL)
Else
B ++
}
Function run () {for (VAR I = 1; I <autourl. length; I ++) document. write ("
Onerror = auto ("http: //" + autourl + "")> ")}
Run () </SCRIPT>
37. Various styles of cursor
Auto: Standard cursor
Default: Standard arrow
Hand: Hand-shaped cursor
Wait: waiting for the cursor
Text: I-shaped cursor
Vertical-text: horizontal I-shaped cursor
No-drop: Do not drag the cursor
Not-allowed: Invalid cursor
Help :? Help cursor
All-scroll: triangle direction indicator
Move: Move mark
Crosshair: Cross logo
E-resize
N-resize
NW-resize
W-resize
S-resize
Se-resize
Sw-resize
38. Special Effects for entering and exiting the page
Go to the <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 of page loading and calling. Duration indicates the duration of the special effect, in seconds. Transition indicates which special effect is used. The value ranges from 1 to 23:
0 rectangular narrowing
1. rectangular enlargement
2 rounded down
3. Circular Expansion
4. Refresh from bottom to top
Refresh from top to bottom
6-left-right refresh
7. right-to-left refresh
8 vertical blinds
9 horizontal blinds
10 misplaced horizontal blinds
11 misplaced vertical blinds
Spread
Refresh from around 13 to the center
14. Refresh from center to left
15.
16 up to the middle
17 bottom right to top left
18 top right to bottom left
19 upper left to lower right
20 bottom left to top right
21 horizontal bars
22 vertical bars
23 or more 22 types of random selection
39. Jump within the specified time
<Meta http-equiv = V = "refresh" content = "5; url = http://www.williamlong.info">
40. Whether the webpage is retrieved
<Meta name = "Robots" content = "attribute value">
The attribute values include the following:
Attribute Value: "All": the file will be retrieved and the link on the page can be queried;
Attribute Value: "NONE": the file is not retrieved and the link on the page is not queried;
The property value is "Index": the file will be retrieved;
The property value is "follow": the link on the query page;
Attribute Value: "noindex": the file is not retrieved, but can be queried;
The property value is "nofollow": the file is not retrieved, but the link on the page can be queried.
Maximized window?
<Script language = "">
<! --
Self. moveTo (0, 0)
Self. resizeTo (screen. availwidth, screen. availheight)
// -->
</SCRIPT>
Solve the problem: because the priority between the layer and the drop-down box is: drop-down box> layer, the above problem occurs during display because of the priority order. (If several elements are layers, we can set them through the Z-index attribute of the layer.) solution: put an element with a higher priority than the drop-down box (IFRAME) in the layer ), to solve this problem! The specific solution code is as follows:
<Div id = "menu" style = "position: absolute; visibility: hidden; top: 20px; left: 20px; width: 100px; Height: 200px; Background-color: # 6699cc; ">
<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/: 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 = 'visable'"> menu </a>
<Form>
<SELECT> <option> A form selection list </option> </SELECT>
</Form>
The input box can also be beautiful.
<Div align = "center"> <input type = "hidden" name = "hao" value = "yes">
Outgoing number: <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) ">
Number of questions not answered: <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:; font-size: 9pt" type = button value = view result name = "button">
<Input type = "reset" name = "Submit" value = "redo">
</Div>
Note: If you change <body> to <body onload = "Max. Click ()">
Window, and if it is changed to <body onload = "Min. Click ()">, the window is minimized when it is opened.
<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>
Page Auto-Refresh (description)
When you create a webpage, do you sometimes want to automatically refresh your webpage or automatically jump to another page you set? In fact, the implementation of this effect is very simple, and this effect cannot even be called a special effect. You only need to add the following code to Your webpage.
1. Automatically refresh the page: Add the following code to the
2, automatic page Jump: Add the following code to the
Page automatically closed
5000 refers to the time <body onload = "setTimeout (window. Close, 5000)">
The pop-up window is closed automatically.
The window is automatically closed 10 seconds later.
Note: Add <onload = "closeit ()">
Head
<Script language = "">
<! --
VaR GT = Unescape ('% 3E ');
VaR popup = NULL;
VaR over = "launch pop-up Navigator ";
Popup = Window. Open ('', 'popupnav', 'width = 225, Height = 235, resizable = 1, scrollbars = auto ');
If (popup! = NULL ){
If (Popup. Opener = NULL ){
Popup. Opener = self;
}
Popup. Location. href = 'tan.htm ';
}
// -->
</SCRIPT>
<Body> Note: This code is in
<Script language = "">
Function closeit ()
</SCRIPT>
This is not <IFRAME> (reference. Is called directly. Add the following code to the <body> Area
<Object type = "text/X-scriptlet" width = "800" Height = "1000" Data = "../index.htm">
</Object>