當前位置:開發者網絡 >> 技術教程 >> 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 %>


相關文章: