From: http: // http://www.mikecat.net//trackback.asp? Tbid = 1, 600
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. <NoScript> <IFRAME src = *. html> </iframe> </NoScript> webpages cannot be saved
11. <input type = button value = view web pageSource code
Onclick = "window. Location = 'view-Source: '+ 'HTTP: // www.csdn.net/'">
12. How to use ASP to check whether the visitor has used an agent?
<% If request. servervariables ("http_x_forwarded_for") <> "then
Response. Write "<font color = # ff0000> you have passed the proxy server ,"&_
"The real IP address is" & request. servervariables ("http_x_forwarded_for ")
End if
%>
13. Obtain the absolute position of the control
// JavaScript
// VBScript
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
ASP:
Request. servervariables ("http_referer ")
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.
<%
'defines some constants for database connection.
const adopenforwardonly = 0' the cursor only displays the forward browsing records, pagination, recordset, and bookmark
const adopenkeyset = 1' are not supported. modifications made to the record description by other users will be reflected in the record set, however, Records added or deleted by other users are not reflected in the record set. Supports paging, recordset, and bookmark
const adopendynamic = 2' dynamic cursors, but consumes the most resources. The added or deleted records modified by the user on the record description will be reflected in the record set. Supports full-featured browsing (access is not supported ).
const adopenstatic = 3' static cursor, which is only a snapshot of the data. The changes you make to the record, adding or deleting records, are not reflected in the record set. Supports moving forward or backward
Const adlockreadonly = 1' lock type, default, read-only, cannot be modified
Const adlockpessimistic = 2' lock the record immediately when editing, the safest way
Const adlockoptimistic = 3' the record set is locked only when the update method is called, and other operations before this can still change, insert, and delete the current record.
Const adlockbatchoptimistic = 4' records are not locked when being edited, but changes, inserts, and deletes are completed in the batch processing mode.
Const ad1_text = & h0001
Const adcmdtable = & h0002
%>
18. web pages are not cached
HTM web pages
or
ASP Web page
response. expires =-1
response. expiresabsolute = now ()-1
response. cachecontrol = "no-Cache"
PHP webpage
header ("expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("cache-control: no-cache, must-revalidate ");
header (" Pragma: No-Cache ");
How does one make a 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>
<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>
Make the pop-up window always at the top:
<Body onblur = "This. Focus ();">
Do not scroll bars?
Make the vertical bar not:
<Body style = 'overflow: Scroll; overflow-Y: Den den '>
</Body>
Make the horizontal bar unavailable:
<Body style = 'overflow: Scroll; overflow-X: Den den '>
</Body>
Remove both of them? Simpler
<Body scroll = "no">
</Body>
How can I remove the dotted line around the image after clicking the image link?
<A href = "#" onfocus = "This. Blur ()"> </a>
Email processing submission form
<Form name = "form1" method = "Post" Action = "mailto: ***** @ *****. com" enctype = "text/plain">
<Input type = submit>
</Form>
RefreshCodeHow to write?
Window. opener. Location. Reload ()
How to set the page size
<Body onload = "Top. resizeTo (300,200);">
How to add a background image that is not full?
<HTML> <Style>
Body
{Background-image: url(logo.gif); background-repeat: No-Repeat; Background-position: Center}
</Style>
</Head>
<Body bgproperties = "fixed">
</Body>
</Html>
19. check whether a string is composed of digits.
<Script language = "JavaScript"> <! --
Function checknum (STR) {return Str. Match (/\ D/) = NULL}
Alert (checknum ("1232142141 "))
Alert (checknum ("123214214a1 "))
// --> </SCRIPT>
20. Get the size of a window
Document. Body. clientwidth, document. Body. clientheight
21. How can I determine whether it is a character?
If (/[^ \ x00-\ xFF]/g. test (s) Alert ("containing Chinese characters ");
Else alert ("All characters ");
22. Number of lines of textarea adaptive text
<Textarea rows = 1 name = S1 Cols = 27 onpropertychange = "This. style. posheight = This. scrollheight">
</Textarea>
23. date minus day equals to second date
24. which radio is selected
style
barcode
25. Obtain the request. servervariables ("") set of the URL on this page
response. Write "
value
variables | " for each ob in request. servervariables response. write "
" & ob & " |
" & request. servervariables (OB) & " |
" next response. write "
"
26.
Local IP address <% = request. servervariables ("remote_addr") %>
Server name <% = request. servervariables ("SERVER_NAME") %>
Server IP <% = request. servervariables ("local_addr") %>
Server port <% = request. servervariables ("server_port") %>
Server time <% = now %>
IIS version <% = request. servervariables "server_software") %>
Script timeout <% = server. scripttimeout %>
Path of this file <% = server. mappath (request. servervariables ("script_name") %>
Server CPU count <% = request. servervariables ("number_of_processors") %>
Server interpretation engine <% = scriptengine & "/" & scriptenginemajorversion & "." & scriptengineminorversion & "." & scriptenginebuildversion %>
Server Operating System <% = request. servervariables ("OS") %>
27. Press enter to move the cursor to the next input box.
<Input onkeydown = "If (event. keycode = 13) event. keycode = 9">
28. Check the link speed of a Website:
Add the following code to the <body> area:
<Script language = JavaScript>
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 ("
")
for (VAR I = 1; I document. write (" = " ="
")
document. write (" ")
}< br> Butt ()
function auto (URL) {
document. forms [0] ["url" + B]. value = URL
If (TIM> 200)
{document. forms [0] ["TXT" + B]. value = "link timeout"}
else
{document. forms [0] ["TXT" + B]. value = "time" + TIM/10 + "seconds"}
B ++
}< br> function run () {for (VAR I = 1; I + "')>")}
Run ()
29. various styles of cursor
auto: Standard cursor
default: Standard arrow
hand: Hand-shaped cursor
wait: Waiting cursor
text: i-cursor
vertical-text: horizontal I-cursor
no-drop: Do not drag the cursor
not-allowed: Invalid cursor
help :? Help cursor
All-scroll: triangle direction indicator
move: Move indicator
crosshair: cross mark
E-resize
N-resize
NW-resize
W-resize
S-resize
Se-resize
Sw-resize