Created
November 10, 2013 15:37
-
-
Save daniel-esparragoza/7399645 to your computer and use it in GitHub Desktop.
Invoke a JavaScript function called with current page's name
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function switchPagina() { | |
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); | |
url = url.length == 0 ? "index.html": url; | |
url = url.split(".")[0]; | |
todasLasPaginas(url); | |
if(window[url]){window[url]();} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment