2012-08-23 4 views
0

Chrome 리소스 파일 (chrome : //resources/js/util.js)에있는이 기능을 사용 중이며 Chrome에서 잘 작동합니다.취소 드래그 앤 셀렉션 이벤트

/** 
    * Disables text selection and dragging. 
    */ 
    function disableTextSelectAndDrag() { 
     // Disable text selection. 
     document.onselectstart = function(e) { 
     e.preventDefault(); 
     } 

     // Disable dragging. 
     document.ondragstart = function(e) { 
     e.preventDefault(); 
     } 
    } 

Internet Explorer 8에서이 이벤트를 취소하고 싶지만 작동하지 않습니다.

IE8에서이 이벤트를 어떻게 취소 할 수 있습니까?

답변

1

이 시도 :

/** 
* Disables text selection and dragging on IE8 and below. 
*/ 
function disableTextSelectAndDragIE8() { 
    // Disable text selection. 
    document.body.onselectstart = function() { 
     return false; 
    } 

    // Disable dragging. 
    document.body.ondragstart = function() { 
     return false; 
    } 
}