문제

내 문서 라이브러리에서 다음 코드 (코드 1)를 사용하여 탐색기에서 열려있는 탐색기 버튼을 성공적으로 숨겼습니다.

<script type="text/javascript"> 
  _spBodyOnLoadFunctionNames.push("hideToolbarItem()");    
  function hideToolbarItem() {   
    var doc = document.getElementsByTagName('ie:menuitem');      
    for (var i = 0; i < doc.length; i++){     
          itm = doc[i];
          if (itm.id.match('OpenInExplorer')!=null){
             itm.hidden=true;          
          }   
    }  
  } 
</script>
.

이제 Outlook 버튼에 연결을 숨기려면

코드를 메뉴 버튼을 참조하지만 작동하지 않았습니다 (코드 2)

<script type="text/javascript"> 
     _spBodyOnLoadFunctionNames.push("hideToolbarItem()");
     function hideToolbarItem() {
       var doc = document.getElementsByTagName('ie:menuitem');
       for (var i = 0; i < doc.length; i++){     
       itm = doc[i];          
        if (itm.id.match('OpenInExplorer')!=null)  
        if (itm.id.match('OfflineButton')!=null){
             itm.hidden=true;          
}   
}  
} 
</script> 
.

또한 동일한 코드를 두 번 사용하지 않습니다 (코드 3)

<script type = "text/javascript" >
    _spBodyOnLoadFunctionNames.push("hideToolbarItem()");
    function hideToolbarItem() {
        var doc = document.getElementsByTagName('ie:menuitem');
        for (var i = 0; i < doc.length; i++) {
            itm = doc[i];
            if (itm.id.match('OpenInExplorer') != null) {
                itm.hidden = true;
            }
        }
    }
</script>
<script type="text/javascript">
    _spBodyOnLoadFunctionNames.push("hideToolbarItem()");
    function hideToolbarItem() {
        var doc = document.getElementsByTagName('ie:menuitem');
        for (var i = 0; i < doc.length; i++) {
            itm = doc[i];
            if (itm.id.match('OfflineButton') != null) {
                itm.hidden = true;
            }
        }
    }
</script> 
.

두 코드 2와 3은 탐색기가 다시 나타나는 것을 열고 Outlook Dissapearing에 연결합니다.나는 둘 다 갔다! 나는 JavaScript에 대해 많이 알지 못한다. 그래서 내가 무엇이 잘못되는지에 대한 설명은 인정 될 것이다 : -)

도움이 되었습니까?

해결책

아래를 사용해보십시오 :

<script type="text/javascript"> 

_spBodyOnLoadFunctionNames.push("hideToolbarItem()");    

function hideToolbarItem() {   
   var doc = document.getElementsByTagName('ie:menuitem');      
   for (var i = 0; i < doc.length; i++)   {     
       itm = doc[i];          
       if (itm.id.match('OpenInExplorer')!=null)  
       {             itm.hidden=true;          }
       if (itm.id.match('OfflineButton')!=null)        
       {             itm.hidden=true;          }   
   }  
}

</script> 
.

다른 팁

자바 스크립트가있는 리본의 물리적 HTML 요소를 숨기는 것과는 대조적으로 이러한 유형의 SharePoint 객체 모델을 사용하는 것이 좋습니다.

여기를 클릭하기위한 커플 링크가 있습니다 (두 번째는 특별히 "탐색기에서 열림"버튼으로 말합니다) :

http : //www.learningsharepoint..com / 2010 / 10 / 24 / hide-ribbon-buttons-sharepoint-2010 - 프로그래밍 방식 /

http : //sharepointegg.blogspot.COM / 2010 / 02 / remove-button-from-in-sharepoint.html

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top