Recommended: Asp+Ajax achieves no refresh to add friends Due to work relationships, one of the functions is to increase the other party as a friend. As shown in the figure: The method used is ajax, and the appropriate code is less expensive: a href=javascript: void(0); onClick =add_username('%= rs(username) %'); Add as friend/a, the js verification used: script language = JavaScript src=ajax.
A asp class used to implement tag function, you can understand the specific functions if you can understand them.
Modify the record:
1. Adding the extension function, 2006-12-3
<%
'*********************************
'Class name: tagEngine
'Name: Tag Engine
'Date: 2006-11-29
'Author: Leng Yue, Xilou
'Website: www.xilou.net | www.chinaCMS.org
'Description: Only the function of extracting tags, no function of parsing tags
'Copyright: Please refer to the source for reprinting, author
'*********************************
'Last modified: 2006-12-3
'Number of modifications: 3
'Modification instructions: Modify the rules to make the match more accurate
'Current version: v1.1.3
'*********************************
Class tagEngine
Private regEx' regular object
'Define tag rules
Private tagbegin
Private tagend
Private blockbegin_begin
Private blockbegin_end
Private blockend_begin
Private blockend_end
'//initialization
Private Sub Class_Initialize()
'Initialize the tag rules
tagbegin={
tagend=}
blockbegin_begin=<Block:
blockbegin_end =>
blockend_begin =</Block:
blockend_end =>
'Initialize the regular object
Set regEx=new RegExp
regEx.IgnoreCase=True' is case-insensitive
regEx.Global=True'Global Match
End Sub
Private Sub Class_Terminate()
'Release the object
If IsObject(regEx) Then Set regEx=Nothing
End Sub
'Method: resetPattern()
'parameter:
'Return: No return value
'Function: Reset the tag rules
Public Sub resetPattern(tagbegin,tagend,_
blockbegin_begin,_
blockbegin_end,_
blockend_begin,_
blockend_end _
)
tagbegin=tagbegin
tagend=tagend
blockbegin_begin=blockbegin_begin
blockbegin_end =blockbegin_end
blockend_begin =blockend_begin
blockend_end =blockend_end
End Sub
'Method: getBlocks(temp,blockname)
'Parameter: temp, the content to match; blockname, block flag name
'Return: Return to the collection object (Matches)
'Function: Get the block tag collection
Public Function getBlocks(temp,blockname)
Dim pattern
pattern=(&blockbegin_begin&[ ]*&blockname&/b[/w/W]*?&blockbegin_end
pattern=pattern&)([/w/W]*?)&blockend_begin&[ /n/r]*&blockname&[ ]*&blockend_end
'Response.Write pattern
regEx.Pattern=pattern
Set getBlocks=regEx.Execute(temp)' returns the matching set
End Function
'Method: getBlockByAtt(temp, attributename, attributevalue)
'Argument: temp, the content to match; attributename, attribute name; attributevalue, attribute value
'Return: Return to the collection object (Matches)
'Function: Obtain a matching set of blocks based on the value of a certain attribute in the block label
Public Function getBlockByAtt(temp, attributename, attributevalue)
Dim pattern
pattern=(&blockbegin_begin&[/w/W]*?[ /n/r]+&attributename
pattern=pattern&[ ]*=[ ]*/&Chr(34)&attributevalue&/&Chr(34)&[ /n/r]*[/w/W]*?
pattern=pattern&blockbegin_end
pattern=pattern&)([/w/W]*?)&blockend_begin&[/w/W]*?&blockend_end
'Response.Write pattern
regEx.Pattern=pattern
Set getBlockByAtt=regEx.Execute(temp)' returns the matching set
End Function
'Method: getAttValue(temp, attributename)
'Article:temp, the content to match; attributename, attribute name
'Return: Return to the collection object (Matches)
'Effect: Get the attribute value in the block tag
Public Function getAttValue(temp, attributename)
Dim pattern
pattern=[ /n/r]+&attributename&[ ]*=[ ]*/&Chr(34)&([^/f/n/r/t/v/&Chr(34)&]*?)/&Chr(34)
'Response.Write pattern
regEx.Pattern=pattern
Set getAttValue=regEx.Execute(temp)
End Function
'Method: parseTag(temp, tagname, tagvalue)
'Argument: temp, the content to match; attributename, attribute name; attributevalue, attribute value
'Return: Return the replaced string
'Effect: Replace simple tags
Public Function parseTag(temp,tagname,tagvalue)
Dim pattern
'pattern=tagbegin&[ ]*&tagname&[ ]*&tagend
pattern=tagbegin&tagname&tagend
regEx.pattern=pattern
parseTag=regEx.Replace(temp,tagvalue)
End Function
'Method: clearBlocks(temp)
'Argument:temp, what to match
'Return: Returns the cleared string
'Effect: Clear all block tags
Public Function clearBlocks(temp)
Dim pattern
pattern=blockbegin_begin&[/w/W]*?&blockbegin_end&[/w/W]*?
pattern=pattern&blockend_begin&[/w/W]*?&blockend_end
regEx.pattern=pattern
clearBlocks=regEx.Replace(temp,)
End Function
'Method: clearTags(temp)
'Argument:temp, what to match
'Return: Returns the cleared string
'Effect: Clear all single tags
Public Function clearTags(temp)
Dim pattern
pattern=tagbegin&[^/f/n/r/t/v]*?&tagend
regEx.pattern=pattern
clearTags=regEx.Replace(temp,)
End Function
'Method: showError(errdes)
'Parameter:errdes, error description
'Return: None
'Effect: Display error
Public Sub showError(errdes)
Dim errinfo,cssstyle
cssstyle=style=&Chr(34)
cssstyle=cssstyle&font:bold 12px 150%,'Arial';border:1px solid #CC3366;
cssstyle=cssstyle&width:50%;color:#990066;padding:2px;&Chr(34)
errinfo=vbcrlf&<ul &cssstyle&><li>&errdes&</li></ul>&vbcrlf
Response.Write errinfo
End Sub
'********************* Standard function ends******************
'The following are custom extensions
'Method: EXT_getSimpleBlocks(temp,blockname)
'Parameter: temp, the content to match; blockname, block flag name
'Return: Return to the collection object (Matches)
'Function: Get a collection of simple block tags
'Example:<Block:new id= loop=/>
Public Function EXT_getSimpleBlocks(temp,blockname)
Dim pattern
Dim blockbegin,blockend
'Redefine the tag rules
blockbegin=<Block:
blockend =/>
pattern=blockbegin&[ ]*&blockname&/b[/w/W]*?&blockend
regEx.pattern=pattern
Set EXT_getSimpleBlocks=regEx.Execute(temp)
End Function
'********************* Standard function ends******************
'The following are custom extensions
'Method: EXT_getSimpleBlocks(temp,blockname)
'Parameter: temp, the content to match; blockname, block flag name
'Return: Return to the collection object (Matches)
'Function: Get a collection of simple block tags
'Example:<Block:new id= loop=/>
Public Function EXT_getSimpleBlocks(temp,blockname)
Dim pattern
Dim blockbegin,blockend
'Redefine the tag rules
blockbegin=<Block:
blockend =/>
pattern=blockbegin&[ ]*&blockname&/b[/w/W]*?&blockend
regEx.pattern=pattern
Set EXT_getSimpleBlocks=regEx.Execute(temp)
End Function
'Method: EXT_getTEXT(path)
'Argument:path, relative or absolute path to the text to be read
'Return: Return text content
'Function: Read the file
'Example: c=EXT_getTEXT(tpl.htm)
Public Function EXT_getTEXT(path)
Dim fso,f,text
On Error Resume Next
Set fso = CreateObject(Scripting.FileSystemObject)
Set f=Fso.OpenTextFile(path)
text=f.ReadAll
If Err Then
Err.Clear
showError An error occurred when reading the file...
If IsObject(fso) Then Set fso=Nothing
Exit Function
End If
If IsObject(fso) Then Set fso=Nothing
EXT_getTEXT=text
End Function
'Method: EXT_getIncludeFile(temp)
'Argument:temp, what to match
'Return: Return to the collection object (Matches)
'Function: parse the block of <!--#include file=tpl.html-->
'Example: EXT_getIncludeFile(temp)(0).SubMatches(0), return the first matching file name
Public Function EXT_getIncludeFile(temp)
Dim pattern
Dim blockbegin,blockend
'Redefine the tag rules
blockbegin=<!--#include
blockend =-->
pattern=blockbegin&[ ]*file[ ]*=[ ]*/([/w/W]*?)/[ ]*&blockend
regEx.pattern=pattern
Set EXT_getIncludeFile=regEx.Execute(temp)
End Function
End Class
%>
Share: ASP restricted IP voting complete example code Due to work relationships, one of the functions is to vote on users, requiring the same IP to vote on the same user only once, post Asp code: % 'Author: Wurong Source: db_conn(dbs) Voteusername=trim(request.QueryString(username)) rs_create(select username from [user] where username ='