Set mailobject = Server.CreateObject ("CDONTS. NewMail ")
Mailobject.from = "Letter Mailbox"
Mailobject.to = "Receiving Mailbox"
mailobject.cc = "CC Mailbox"
MAILOBJECT.BCC = "Secret Send Mailbox"
Mailobject.subject = "message subject"
Mailobject.body = "message content"
Mailobject.mailformat = 0 ' message format, 0 is MIME format, 1 is text message
Mailobject.bodyformat = 0 ' text format for message, 0 for HTML format, 1 for plain text
Mailobject.importance = 1 ' Importance of mail, 0 is for low importance, 1 is normal, 2 means high importance
Mailobject.attachfile "Attachment absolute path", "Attachment name"
Mailobject.send
Set Mailobject = Nothing
2. Web pages are not cached
Response.Expires =-1
Response.ExpiresAbsolute = Now ()-1
Response.CacheControl = "No-cache"
3. Client IP Address
Request.ServerVariables ("REMOTE_ADDR")
4. Method of Recordset object:
Rs.movenext moves the record pointer down one row from the current position
Rs.moveprevious move the record pointer up one row from the current position
Rs.movefirst move the record pointer to the first row of the datasheet
Rs.movelast move the record pointer to the last row of the datasheet
Rs.absoluteposition=n move the record pointer to the nth row of the datasheet
Rs.absolutepage=n move the record pointer to the first row of page N
Rs.pagesize=n set every page to N records
Rs.pagecount returns the total number of pages based on pagesize settings
Rs.recordcount returns the total number of records
RS.BOF returns whether the record pointer is over the first end of the datasheet, True indicates Yes, FALSE is no
Rs.eof returns whether the record pointer is over the end of the datasheet, True indicates Yes, FALSE is no
Rs.delete deletes the current record, but the record pointer does not move down
Rs.addnew add records to the end of the datasheet
Rs.update Update datasheet Record
5. Random number Working type
INT ((upper bound-lower bound + 1) * Rnd + lower bound)
6. Check the input function
Function Check_input (Input)
input = Trim (input) ' Removes extra space
input = Server.HTMLEncode (input) ' Convert HTML
input = Replace (INPUT,CHR (39), "'") ' Convert half-angle single quotes
input = Replace (INPUT,CHR (34), "" ") ' Convert half-angle double quotation mark
Checkinput = input
End Function
Method 2:
Set conn = Server.CreateObject ("ADODB. Connection ")
Conn. Open "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &server.mappath ("Data.mdb")
1. oncontextmenu= "Window.event.returnvalue=false" will completely screen the right mouse button
<table border Oncontextmenu=return (false) ><td>no</table> available for table
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=" &T&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")
<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
18. Web pages are not cached
HTM Web page
<meta http-equiv= "Pragma" content= "No-cache" >
<meta http-equiv= "Cache-control" content= "No-cache, must-revalidate" >
<meta http-equiv= "Expires" content= "Wed 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 Web page
Header ("Expires:mon, June June 1997 05:00:00 GMT");
Header ("Cache-control:no-cache, must-revalidate");
Header ("Pragma:no-cache");
19. Check whether a string of strings is all composed of numbers
<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 to judge whether it is a character
if (/[^\x00-\xff]/g.test (s)) alert ("contains Chinese characters");
else alert ("All characters");
22.TEXTAREA the number of adaptive lines of text
<textarea Rows=1 name=s1 cols=27 onpropertychange= "This.style.posheight=this.scrollheight" >
</textarea>
23. Date minus days equals second date
<script language=javascript>
function cc (DD,DADD)
{
You can add error handling
var a = new Date (DD)
A = A.valueof ()
A = A-dadd * 24 * 60 * 60 * 1000
A = new Date (a)
Alert (a.getfullyear () + "year" + (A.getmonth () + 1) + "month" + a.getdate () + "Day")
}
CC ("12/23/2002", 2)
</script>
24. Which radio was chosen
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></HTML>
25. Get the Request.ServerVariables ("") collection of the URL on this page
Response.Write "<table border=1><!--TABLE Header--><tr><td><b>variables</b> </TD><TD><B>value</B></TD></TR> "
For each OB in Request.ServerVariables
Response.Write "<TR><TD>" &ob& "</TD><TD>" &request.servervariables (OB) & " </TD></TR> "
Next
Response.Write "</TABLE>"
26.
Native Ip<%=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 Time <%=Server.ScriptTimeout%>
This file path <%=server.mappath (Request.ServerVariables ("Script_name"))%>
Server CPU number <%=request.servervariables ("Number_of_processors")%>
Server Interpreter engine <%=scriptengine & "/" & ScriptEngineMajorVersion & "." &ScriptEngineMinorVersion& "." & ScriptEngineBuildVersion%>
Server operating system <%=request.servervariables ("OS")%>
The 27.ENTER key allows the cursor to move to the next input box
<input onkeydown= "if (event.keycode==13) event.keycode=9" >
28. Detect the link speed of a website:
Add the following code to the <body> area:
<script language=javascript>
Tim=1
SetInterval ("tim++", 100)
B=1
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.