Essence ASP Code

Source: Internet
Author: User
Tags servervariables
Elite 1. Oncontextmenu= "Window.event.returnvalue=false" will completely mask the right mouse button
<table border Oncontextmenu=return (false) ><td>no</table> available for table

2. <body onselectstart= "return false" > deselect, prevent copying

3. onpaste= "return false" is not allowed to paste

4. oncopy= ' return false; ' oncut= ' return false; ' Prevent replication

5. <link rel= "shortcut icon" href= "Favicon.ico" > IE Address bar before replacing their own icons

6. <link rel= "Bookmark" href= "Favicon.ico" > can display your icon in a Favorites folder

7. <input style= "ime-mode:disabled" > Close IME

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

9. Prevent a person from being frame
<script language=javascript><!--
if (top.location!= self.location) top.location=self.location;
--></script>

<noscript><iframe src=*.html></iframe></noscript> Web pages will not be saved as

<input type=button value= View Web page source code
onclick= "window.location = ' view-source: ' + ' http://www.csdn.net/'" >

12. How to use the ASP means to check whether the visitor used the agent
<% if Request.ServerVariables ("Http_x_forwarded_for") <> "" Then
Response.Write "<font color= #FF0000 > You have passed the proxy server," & _
"True IP is" &request.servervariables ("Http_x_forwarded_for")
End If
%>

13. Get 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=" &AMP;T&AMP;CHR & "left=" &l,64, "get position of control"
End Function
--></script>

14. Cursor is stopped at the end of text box text
<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. Determining the origin of the previous page
Asp:
Request.ServerVariables ("Http_referer")

Javascript:
Document.referrer

16. Minimize, maximize, close windows
<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= Minimize onclick=hh1. Click () >
<input Type=button value= maximize ONCLICK=HH2. Click () >
<input Type=button value= closes Onclick=hh3. Click () >
This example applies to IE

17.
<%
' Define some constants for database connections
The Const adopenforwardonly = 0 ' cursor only browses the record forward, does not support paging, Recordset, BookMark
The Const adOpenKeyset = 1 ' keyset cursor, the changes that other users make to the record are reflected in the recordset, but additional users adding or deleting records are not reflected in the recordset. Support paging, Recordset, BookMark
The Const adopendynamic = 2 ' Dynamic cursors are the most powerful, but also the most expensive sources. User changes to the record, add or delete records will be reflected in the recordset. Supports full feature browsing (not supported by Access).
Const adopenstatic = 3 ' static cursors, just a snapshot of the data, changes that the user makes to the record, adding or deleting records are not reflected in the recordset. Supports moving forward or backward

Const adlockreadonly = 1 ' lock type, default, read-only, cannot make any changes
Const adlockpessimistic = 2 ' When editing immediately locks records, the safest way
Const adlockoptimistic = 3 ' The recordset is locked only when the Update method is called, while other previous operations can still make changes, inserts, and deletes to the current record.
Const adlockbatchoptimistic = 4 ' records are not locked while editing, and changes, inserts, and deletions are done in batch mode

Const adCmdText = &h0001
Const adCmdTable = &h0002
%>

18. Web pages are not cached
HTM Web page
<meta http-equiv= "Pragma" content= "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.