How to get the file name of the page? When you need to read the file name of the current page in javascript you can use the document.location.href string and parse it to find the filename, here is the script that strips away the other chars and keep only the script file name:
function getFileName() { var url = document.location.href; url = url.substring(0, (url.indexOf("#") == -1) ? url.length : url.indexOf("#")); url = url.substring(0, (url.indexOf("?") == -1) ? url.length : url.indexOf("?")); url = url.substring(url.lastIndexOf("/") + 1, url.length); return url; }
Another usefull function is the one that get the parameters from the url.
Most excellent! Thanks!