Monday, September 13, 2010

SharePoint welcome.ascx change PT-PT login message

In SharePoint sites language 2070 (PT-PT), login welcome message is
"Bem-vindo a [DOMAIN\USER]"

we can change this message with javascript, finding the Menu ID of the link button.

_spBodyOnLoadFunctionNames.push("welcomeBemVindo");
function welcomeBemVindo() {

var re= new RegExp('_Menu','g')
var el = document.getElementsByTagName('a');
for(var i=0;i {
if(el[i].id.match(re))
{
var content = document.getElementById(el[i].id);
content.innerHTML = content.innerHTML.replace("Bem-vindo a", "Bem-vindo");

}
}

}

the id is dynamic, so we have to use a regular expression to get it.
usually it is zz8_Menu but it can change for other pages

No comments:

Post a Comment