Board logo

標題: [java/VB script] 如何取得目前檔名? [打印本頁]

作者: gswdkimo    時間: 2011-4-27 18:26     標題: 如何取得目前檔名?

VBScript:
  1. <SCRIPT  LANGUAGE="VBScript">
  2. function  ShowName()
  3. Dim  strAllName,  strName
  4. Dim  intTemp
  5. strAllName  =  Window.Location
  6. intTemp  =  InStrRev(strAllName,  "/")
  7. strName  =  Right(strAllName,  Len(strAllName)  -  intTemp)
  8. MsgBox  strName
  9. ShowName  =  strName
  10. End  function
  11. </SCRIPT>
  12. <BUTTON  onClick="ShowName()">目前檔名為...</BUTTON>
複製代碼
-----------------------------------------------------------------------------
javascript:
  1. <script type="text/javascript">
  2. <!--
  3. //先以?字元取出目前不含參數的url,再以/字元拆解並存至LSA陣列
  4. var  LSA  =  location.href.split("?")[0].split("/");
  5. //取出陣列的最後一項即為目前檔名
  6. var  CFN  =  LSA[LSA.length-1];
  7. //印出檔名
  8. document.write(CFN);
  9. //location.href=CFN;//轉向該網頁
  10. //-->
  11. </script>
複製代碼





歡迎光臨 資訊家電班NO7 (http://imce07.freehostia.com/forums/) Powered by Discuz! 7.2