I have a tiny problem.
I have used this function in the HTML page and it works but doesn't when i call it from a js file
HTML CODE
JS CODE
It does not write any code once the page is loaded and i can't see what i'm doing wrong here.
I have used this function in the HTML page and it works but doesn't when i call it from a js file
HTML CODE
Code:
script language="javascript" src="../js/Menu.js">
var page1 = window.location.pathname
page = setMenuTop(page1);
document.write(page);
</script>
Code:
function setMenuTop(sPath)
{
var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
var sPageName = sPage.replace('.aspx', '');
if (sPageName === '100') {
sPageName = 'Top 100';
}
if (sPageName === 'Main') {
sPageName = 'Home';
}
return sPageName;
}
Comment