Hi all, I've been doing some research on url names. The problem is, I need this code to return like say "index.php", it would return "index". But idk where I went wrong..
Anyway..
The code:
ANY help is GREATLY appreciated!Code:<script> var sPage; var sPath = window.location.pathname; //var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1); //var sPage = sPath.substring(sPath.lastIndexOf('/') + 1); if(sPath.substring(sPath.lastIndexOf('.') + 1)){ sPage=sPath.split("",3); } sPage = sPath.substring(sPath.lastIndexOf('/') + 1); alert(sPage); </script>
~SI~




Reply With Quote


Bookmarks