有时,您可能希望获得当前页面的网址是在浏览器窗口中显示网址。例如,如果您想让您的访客提交博客张贴到Digg您需要得到同样的确切网址。有很多其他原因也很多。这里就是你如何能够做到这一点。
下面的代码添加到页面:
function curPageURL()
dim s, protocol, port
if Request.ServerVariables("HTTPS") = "on" then
s = "s"
else
s = ""
end if
protocol = strleft(LCase(Request.ServerVariables("SERVER_PROTOCOL")), "/") & s
if Request.ServerVariables("SERVER_PORT") = "80" then
port = ""
else
port = ":" & Request.ServerVariables("SERVER_PORT")
end if
curPageURL = protocol & "://" & Request.ServerVariables("SERVER_NAME") &_
port & Request.ServerVariables("SCRIPT_NAME")
end function
function strLeft(str1,str2)
strLeft = Left(str1,InStr(str1,str2)-1)
end function
%>
现在,您可以得到当前页面的URL使用行
response.write(curPageURL())
%>
如果您的网页有你想要查询字符串信息以及您可以尝试这样的代码:
response.write(curPageURL() & "?" & Request.ServerVariables("QUERY_STRING"))
%>
下面的示例演示如何做到这一点:
function curPageName()
dim pagename
pagename = Request.ServerVariables("SCRIPT_NAME")
if inStr(pagename, "/") > 0 then
pagename = Right(pagename, Len(pagename) - instrRev(pagename, "/"))
end if
curPageName = pagename
end function
response.write("The current page name is " & curPageName())
%>
疯狂医院达什医生中文版(Crazy Hospital)
疯狂医院达什医生最新版是一款医院模拟经营类游戏,逼真的场景画
宝宝庄园官方版
宝宝庄园官方版是一款超级经典好玩的模拟经营类型的手游,这个游
桃源记官方正版
桃源记是一款休闲娱乐类的水墨手绘风格打造的模拟经营手游。玩家
长途巴士模拟器手机版
长途巴士模拟器汉化版是一款十分比真好玩的大巴车模拟驾驶运营类
房东模拟器最新版2024
房东模拟器中文版是一个超级有趣的模拟经营类型的手游,这个游戏