1 定位OWSBROWS.JS文件,这个文件在%SystemRoot%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\template\layouts\2052目录中
2 在该文件中加入一个Window Load事件响应函数,以删除帮助链接,源代码如下转载自MSD2D:
/*ideas coming from Mark Beecham
http://www.msd2d.com/Content/Tip_viewitem_03.aspx?section=SharePoint&category=Development&id=b73b9ea8-a678-47d0-b440-002b7f1c5ab3
*/
/*
Open the OWSBROWS.JS and locate the line:
var browseris = new Browseris();
Paste the following code under this line.
*/
/* START - Custom Code*/
//Remove Only Help from the top Banner
//Attach to Load event
window.attachEvent("onload", new Function("DelHelp_OnLoad();"));
//Handles Addition of "Remove Help" link from top banner
function DelHelp_OnLoad()
{
try{
//hlMySite.innerText=""; //this hidden code line can remove the "MySite"from the top banner
//Get all Tags named "A"
var aTags = document.getElementsByTagName("A");
//Look for "Help" innerText - generally speaking it is the first one
for(var j=0;j<aTags.length;j++){
var aTag = aTags(j);
//If match found
if(aTag.innerText=="帮助")
{
aTag.innerText="";//assign the empty string to it;
break;//foudn and then get out of the loop
}//end of if
}//end of for
}//try
catch(e){
//Do Nothing - if it doesn't work then no logout appears
}//end of try
}//end of fucntion Del Help
/* END - Custom Code*/
http://www.msd2d.com/Content/Tip_viewitem_03.aspx?section=SharePoint&category=Development&id=b73b9ea8-a678-47d0-b440-002b7f1c5ab3
*/
/*
Open the OWSBROWS.JS and locate the line:
var browseris = new Browseris();
Paste the following code under this line.
*/
/* START - Custom Code*/
//Remove Only Help from the top Banner
//Attach to Load event
window.attachEvent("onload", new Function("DelHelp_OnLoad();"));
//Handles Addition of "Remove Help" link from top banner
function DelHelp_OnLoad()
{
try{
//hlMySite.innerText=""; //this hidden code line can remove the "MySite"from the top banner
//Get all Tags named "A"
var aTags = document.getElementsByTagName("A");
//Look for "Help" innerText - generally speaking it is the first one
for(var j=0;j<aTags.length;j++){
var aTag = aTags(j);
//If match found
if(aTag.innerText=="帮助")
{
aTag.innerText="";//assign the empty string to it;
break;//foudn and then get out of the loop
}//end of if
}//end of for
}//try
catch(e){
//Do Nothing - if it doesn't work then no logout appears
}//end of try
}//end of fucntion Del Help
/* END - Custom Code*/
3 保存后刷新网页即可看到效果
另:OWSBROWS.JS作用于所有网页,修改之后SPS所有网页都将没有帮助菜单。注意编辑OWSBROWS.JS文件时注意该文件是UTF-8格式,注意保持格式,特别是中文版SPS,我一开始没有注意,始终不能使aTag.innerText=="帮助"条件成立。 修改之后的效果你可以看到帮助链接一闪之后就消失了,这是因为实际上SPS是将该链接生成并送到浏览器了,而加入的代码在页面加载时在将该链接去掉所以看不到,实际上在页面的HTML源代码中还是看得到这个链接的。尽管如此,这个方法应该是比较好的一个了(除非重新开发一个服务端控件代替SPS自带的那个):帮助链接由SPSWC:PageHeader服务端控件生成,这类控件运行机制我还不清楚,但是其运行代码应该已经编译成DLL了。