<script> <BR>function getRootPath(> <BR><script> <BR>function getRootPath(3)> strFullPath=window.document.location.href; <BR>var strPath=window.document.location.pathname; <BR>var pos=strFullPath.indexOf(strPath); <BR>var prePath=strFullPath.substring. ); <BR>var postPath=strPath.substring(0,strPath.substr(1).indexOf('/') 1); <BR>return(prePath postPath); <BR>} <BR>var webpath=getRootPath (); //webpath就是目錄路徑變數<BR></script>