ASP:Crazy蛙!模版操作类(最简单的模板类、仅提供交流)
文件名:Awa_temp.Class.asp
<%
'Crazy蛙!模板操作类
'作者Crazy~蛙! QQ:379969387 欢迎交流
'版本V1.0;
Class AwaTemp
Public aa
Private FSO,StrTemp,FileData,GetDatas,StrHtmlName,htmlwrite,StrLabel,StrLValues
'===========================================
'构造函数_初始化FSO组件
'===========================================
Private Sub Class_Initialize()
Set FSO=Server.CreateObject("Scripting.FileSystemObject")
End Sub
'===========================================
'构析函数_销毁FSO组件
'===========================================
Private Sub Class_terminate()
Set FSO=nothing
End Sub
'===========================================
'类属性
'===========================================
'版本信息
Public Property Get Version
Version="Crazy~蛙! 模板操作类!V1.0版本;"
End Property
'获取模板地址以及名称
Public Property Let Temp(ByVal Values)
StrTemp=Values
End Property
'获取生成文件的文件名
Public Property Let HtmlName(ByVal Values)
StrHtmlName=Values
End Property
'获取标签
Public Property Let Label(ByVal Values)
StrLabel=Values
End Property
'获取将标签替换的值
Public Property Let LValues(ByVal Values)
StrLValues=Values
End Property
'===========================================
'类方法
'===========================================
'检查模板设置以及是否存在
Private Function Check()
If StrTemp="" Then
Check="<span style='color:red;'>错误:未设置模板文件存储位置!</span>"
Else
If FSO.FileExists(StrTemp)=false Then
Check="<span style='color:red;'>错误:指定模板不存在!</span>"
Else
Check=true
End If
End If
End Function
'读取模板页
Public Sub ReadTemp()
If Check()<>true Then
Response.Write Check()
&nb
相关文档:
<% dim xml,root,allitem,nodecount
set xml=server.CreateObject("MicroSoft.XMLDom")
xml.load(server.mappath("style.xml"))
if xml.parseError.errorCode <> 0 then ......
按“F12”试试效果。
注:常用的时间函数:
now() 获取当前系统日期和时间,ASP输出可以这样写:<%=now()%>
Year(now()) 获取年份 ......
在 ASP 中,有两个很常用的集合,一个是 Request.QueryString,另一个是 Request.Form。这两个集合可以获取 HTML 表单(HTML Forms) 提交的信息。
有关 HTML 表单,请参见 HTML 教程中的 HTML表单 一章。
Request.QueryString
HTML 表单中的 method 有两种,一种是 get,另外一种是 post。当 HTML 表单的 metho ......
<%
'true=是邮件;false=不是;
Function validate(ByVal str)
Dim temp,reg
Set reg = new regexp
reg.ignorecase=true
reg.global=true
reg.pattern = "^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
validate = reg.test(Trim(str))
Set reg = Nothing
End Function
'************************ ......
COM接口VC实现,接口:
[id(1), helpstring("method Test")] HRESULT Test([in] BSTR strInputA, [in] BSTR strInputB, [out,retval] VARIANT* result);
ASP调用:
Set objCompInfo =server.CreateObject("组件在系统中的名字")
  ......