Some collection codes of ASP

Source: Internet
Author: User

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"; file &: // 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 webpage source code

Onclick = "window. location = 'view-source: '+ 'HTTP: // www.csdn.net/&#39;">

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

File &: // 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>

File &: // 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

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.

<%

'Define some constants for database connection

Const adOpenForwardOnly = 0' the cursor only browses records forward. pagination, Recordset, and BookMark are not supported.

Const adOpenKeyset = 1' indicates the keyset cursor. modifications made by other users to the record are reflected in the record set. However, adding or deleting records by other users is not reflected in the record set. Supports paging, Recordset, and BookMark

Const adOpenDynamic = 2' the most dynamic cursor function, but the most resource consumption. 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' the static cursor is only a snapshot of the data. The changes you make to the record description, adding or deleting records, will not be 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. The webpage will not be cached

HTM webpage

<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">

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 ");

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.