ASP

本类阅读TOP10

·asp常用数据库连接方法和技巧
·无组件生成BMP验证码
·一些常用的辅助代码 (网络收藏)
·JavaScript实现的数据表格:冻结列、调整列宽和客户端排序
·VisualStudio.NET_2003及其 MSDN 下载地址
·ASP模拟MVC模式编程
·图片以二进制流输出到网页
·MD5加密算法 ASP版
·ASP.NET编程中的十大技巧
·改进 ASP 的字符串处理性能

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
ASP中的一些小问题收集

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

==========计算页面的执行时间===========

<%
dim startime,endtime
startime=timer()
%>

    <%
dim startime,endtime
startime=timer()
%>

    最后就是在页面代码的最后面加入以下代码:

<%
endtime=timer()
response.write "页面执行时间:"&FormatNumber((endtime-startime)*1000,3)&"毫秒"
response.end
%>

<%
endtime=timer()
response.write "页面执行时间:"&FormatNumber((endtime-startime)*1000,3)&"毫秒"
response.end
%>

========取完整url的函数=========

<%
Dim temp,ServerUrl
Temp=Split(Request.servervariables("SERVER_PROTOCOL"),"/")
ServerUrl=Temp(0)& "://" & Request.ServerVariables("Server_name") & Request.ServerVariables("Script_name")
if request.ServerVariables("QUERY_STRING")<>"" then ServerUrl=ServerUrl&"?"
ServerUrl=ServerUrl&request.ServerVariables("QUERY_STRING")
response.write ServerUrl &"<br>"
%>

<%
Dim temp,ServerUrl
Temp=Split(Request.servervariables("SERVER_PROTOCOL"),"/")
ServerUrl=Temp(0)& "://" & Request.ServerVariables("Server_name") & Request.ServerVariables("Script_name")
if request.ServerVariables("QUERY_STRING")<>"" then ServerUrl=ServerUrl&"?"
ServerUrl=ServerUrl&request.ServerVariables("QUERY_STRING")
response.write ServerUrl &"
"
%>

============显示当前目录下所以的文件==========

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%=server.MapPath("\")%>
<%
'Set fso = CreateObject("Scripting.FileSystemObject")
'fso.CreateFolder ("e:\fd")
'fso.files ("e:\")
dirtowalk="web"
set fs=server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFolder(server.MapPath(dirtowalk))
set fc=f.files
for each whatever in fc
response.Write "<a href='"
response.Write whatever.name
response.Write "'>"
response.Write whatever.name&"   "&whatever.datecreated
response.Write "</a><br>"
next
%>
<%=server.MapPath("\")%>
<%
'Set fso = CreateObject("Scripting.FileSystemObject")
'fso.CreateFolder ("e:\fd")
'fso.files ("e:\")
dirtowalk="web"
set fs=server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFolder(server.MapPath(dirtowalk))
set fc=f.files
for each whatever in fc
response.Write ""
response.Write whatever.name&"?? "&whatever.datecreated
response.Write "

"
next
%>

=======计算中英文字符串的总长度=========

<%
Function CheckStringLength(txt)
     txt=trim(txt)
     x = len(txt)
     y = 0
     for ii = 1 to x
        if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then  
 ' 如果是中文
            y = y + 2
        else
            y = y + 1
        end if
     next
     CheckStringLength = y

    End Function
response.Write(CheckStringLength("fsdfs地在在dfsdf"))
%><%
Function CheckStringLength(txt)
???? txt=trim(txt)
???? x = len(txt)
???? y = 0
???? for ii = 1 to x
??????? if asc(mid(txt,ii,1)) < 0 or asc(mid(txt,ii,1)) >255 then??
?' 如果是中文
??????????? y = y + 2
??????? else
??????????? y = y + 1
??????? end if
???? next
???? CheckStringLength = y

??? End Function
response.Write(CheckStringLength("fsdfs地在在dfsdf"))
%>




相关文章

相关软件