如何去掉最上面的“帮助”链接

SPS页面最上方的“帮助”链接是写在webcontrol里的,我们无法通过常规方法修改掉。不过也有变通的方法,可以通过js脚本来完成。
基本操作过程如下:
1 定位OWSBROWS.JS文件,这个文件在%SystemRoot%\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\template\layouts\2052目录中
2 在该文件中加入一个Window Load事件响应函数,以删除帮助链接,源代码如下转载自Mark Beecham
/*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*/
3 保存后刷新网页即可看到效果

另:OWSBROWS.JS作用于所有网页,修改之后SPS所有网页都将没有帮助菜单。注意编辑OWSBROWS.JS文件时注意该文件是UTF-8格式,注意保持格式,特别是中文版SPS,我一开始没有注意,始终不能使aTag.innerText=="帮助"条件成立。 修改之后的效果你可以看到帮助链接一闪之后就消失了,这是因为实际上SPS是将该链接生成并送到浏览器了,而加入的代码在页面加载时在将该链接去掉所以看不到,实际上在页面的HTML源代码中还是看得到这个链接的。

posted on 2006-06-15 17:27  hades  阅读(280)  评论(0编辑  收藏  举报

导航