Hi all:
I have created a .js file that have some functions that will get executed when the application loads on a user's browser. Inside the functions, I was trying to prevent some of the codes from being executed depending on the page's url and it works if I only supply one page url in the if/else clause but fails to work if I supply multiple urls. Below is the code that I have.
function CNETLogout_OnLoad()
{
if(self.location.href != " try{
//Check if already altered
if (!CNETlogoutOnLoadDone){
//Get all table cells
var tableCellCol = document.getElementsByTagName("Td");
//Look for "ms-banner" class - should only be one
for(var i=0;i<tableCellCol.length;i++){
var cellElm = tableCellCol(i);
//If match found...
if (cellElm.className == "ms-banner"){
//Add Link for "Logout"
cellElm.innerHTML += <a href=javascript:CNETLogoff()>Log Out</a>";
break;
}
}
//Set altered flag
CNETlogoutOnLoadDone = true;
}
}
catch(e){
//Do Nothing - if it doesn't work then no logout appears
}
}
}
}
if I add more than one page to be validated in the if/else clause like this then the whole validation fails and displays the "Logout" link on every single page.
eg.
if(self.location.href != " || self.location.href != " try{
the rest of the code from above goes here....
Could someone please let me know what I'm doing wrong.
Thanks in advance.
"Behind every great fortune there lies a great crime", Honore De Balzac
I have created a .js file that have some functions that will get executed when the application loads on a user's browser. Inside the functions, I was trying to prevent some of the codes from being executed depending on the page's url and it works if I only supply one page url in the if/else clause but fails to work if I supply multiple urls. Below is the code that I have.
function CNETLogout_OnLoad()
{
if(self.location.href != " try{
//Check if already altered
if (!CNETlogoutOnLoadDone){
//Get all table cells
var tableCellCol = document.getElementsByTagName("Td");
//Look for "ms-banner" class - should only be one
for(var i=0;i<tableCellCol.length;i++){
var cellElm = tableCellCol(i);
//If match found...
if (cellElm.className == "ms-banner"){
//Add Link for "Logout"
cellElm.innerHTML += <a href=javascript:CNETLogoff()>Log Out</a>";
break;
}
}
//Set altered flag
CNETlogoutOnLoadDone = true;
}
}
catch(e){
//Do Nothing - if it doesn't work then no logout appears
}
}
}
}
if I add more than one page to be validated in the if/else clause like this then the whole validation fails and displays the "Logout" link on every single page.
eg.
if(self.location.href != " || self.location.href != " try{
the rest of the code from above goes here....
Could someone please let me know what I'm doing wrong.
Thanks in advance.
"Behind every great fortune there lies a great crime", Honore De Balzac