当前位置:开发者网络 >> 技术教程 >> ASP教程 >> 脚本编码 >> 内容
精彩推荐
分类最新教程
分类热点教程
  
asp常 用 代 码
作者:未知
日期:2004-11-05
人气:
投稿:snow(转贴)
来源:未知
字体:
收藏:加入浏览器收藏
以下正文:
显示页面加载时间

页面顶部添加下面的代码:

<%
Dim strStartTime
Dim strEndTime

strStartTime = Timer '开始时间
%>

页面(同一页)的末尾添加:

<%
' 加载完毕的时间
strEndTime = Timer

Response.Write ("页面加载时间: ")

Response.Write FormatNumber(strEndTime - strStartTime, 4)
Response.Write (" 秒.")
%>

显示字符串前20个字符并在结尾处添加“……”

<%
Dim CutShort
CutShort = rsYourRecordset.Fields.Item("YourField").Value
Response.Write LEFT (CutShort, 20) & "........"
%>

如果动态图片为空,用默认图片代替

<%
Dim PicShow
PicShow = rsShowHide.Fields.Item("shMainPix").Value
IF PicShow <>"" THEN %>
<img src="<%=rsShowHide.Fields.Item("shMainPix").Value%>">
<% ELSE %>
<img src="StaticPic.gif">
<% End If %>


相关文章: