<%
'--------------------------格式化网址-----------------------------------------------------------------------
Function FormatUrl(RelativelyUrl,ObjURL)
'==================================================
'
'参数说明:
'RelativelyUrl: 相对地址 ,例如:../content
'ObjURL: 绝对地址 , 例如:
http://www.ffasp.com/bbs飞飞Asp!技术乐园'==================================================
'更多资料请访问 飞飞Asp乐园
http://www.ffasp.com'==================================================
Dim URLSearchLoc
if Left(LCase(NewsLinkStr),7) <> "http://" then
Dim CheckURLStr,TempCollectObjURL,CheckObjURL
NewsLinkStr = Replace(Replace(Replace(NewsLinkStr,"'",""),"""","")," ","")
TempCollectObjURL = Left(ObjURL,InStrRev(ObjURL,"/"))
CheckObjURL = NewsLinkStr
CheckURLStr = Left(NewsLinkStr,3)
if Left(NewsLinkStr,1) = "/" then
URLSearchLoc = InStr(ObjURL,"//") + 2
FormatUrl = Left(ObjURL,InStr(URLSearchLoc,ObjURL,"/") - 1)
FormatUrl = FormatUrl & NewsLinkStr
elseif CheckURLStr = "../" then
do while Not CheckURLStr <> "../"
CheckObjURL = Mid(CheckObjURL,4)
if Right(TempCollectObjURL,1) = "/" then TempCollectObjURL = Left(TempCollectObjURL,Len(TempCollectObjURL) - 1)
TempCollectObjURL = Left(TempCollectObjURL,InStrRev(TempCollectObjURL,"/"))
CheckURLStr = Left(CheckObjURL,3)
Loop
FormatUrl = TempCollectObjURL & CheckObjURL
else
FormatUrl = TempCollectObjURL & NewsLinkStr
end if
else
FormatUrl = NewsLinkStr
end If
End Function
'-------------------------------------------------------------格式化网址结束-------------------------------------------
'例:
Response.Write(FormatUrl("../index.asp","
http://www.ffasp.com/bbs/飞飞As,p技术乐园"))
%>