您现在的位置:中国下载站学院中心网络编程ASP教程ASP开发技巧 → 文章列表

ASP中的一些小问题收集

作者:佚名  来源:不详  发布时间:2006-12-28 22:27:17   

减小字体 增大字体

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


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

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

<%
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>"
%>


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

<%@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
%>



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

<%
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"))
%>


在百度中搜索更多ASP中的一些小问题收集相关网页 转贴于:中国下载站

  • 上一篇文章:ASP经典分页类
  • 下一篇文章:网站设计中配色技巧
  • 阅读统计:[]
  • 中国下载站】【设为主页】【收藏本页】【打印本文】【回到顶部】【关闭此页

    相关文章
    文章评论(评论内容只代表网友观点,与本站立场无关!)

    用户名: 查看更多评论

    分 值:100分 85分 70分 55分 40分 25分 10分 0分

    内 容:

             (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码


    设为首页 - 关于我们 - 广告服务 - 网站地图 - 加入收藏 - 网站声明 - 网站帮助 - 友情链接

    • Copyright (C) 2006-2008 www.cndownz.com All Rights Reserved.
      中国下载站 版权所有. 粤ICP备05141802号. 对本站有任何建议、意见或投诉,请来信:cndownzcom@yahoo.com.cn.
      喜欢中国下载站(cndownz.com),请把中国下载站(cndownz.com)告诉你QQ上的5位好友,多谢支持!