標題:
[java/VB script]
如何取得目前檔名?
[打印本頁]
作者:
gswdkimo
時間:
2011-4-27 18:26
標題:
如何取得目前檔名?
VBScript:
<SCRIPT LANGUAGE="VBScript">
function ShowName()
Dim strAllName, strName
Dim intTemp
strAllName = Window.Location
intTemp = InStrRev(strAllName, "/")
strName = Right(strAllName, Len(strAllName) - intTemp)
MsgBox strName
ShowName = strName
End function
</SCRIPT>
<BUTTON onClick="ShowName()">目前檔名為...</BUTTON>
複製代碼
-----------------------------------------------------------------------------
javascript:
<script type="text/javascript">
<!--
//先以?字元取出目前不含參數的url,再以/字元拆解並存至LSA陣列
var LSA = location.href.split("?")[0].split("/");
//取出陣列的最後一項即為目前檔名
var CFN = LSA[LSA.length-1];
//印出檔名
document.write(CFN);
//location.href=CFN;//轉向該網頁
//-->
</script>
複製代碼
歡迎光臨 資訊家電班NO7 (http://imce07.freehostia.com/forums/)
Powered by Discuz! 7.2