document.oncontextmenu 와 마우스 우클릭
1. 마우스 우클릭 시 펑션 실행
자바스크립트에서 document.oncontextmenu 가 기본값(null)이면 마우스 우클릭 가능.
= function(){} 으로 펑션 대입하면 마우스 우클릭시 펑션 실행.
2. 마우스 우클릭 막기
마우스 우클릭 막으려면 함수를 대입하되 내용을 비워두면 됨.
혹은
function document.oncontextmenu() {
return false;
}
식으로 쓴다.
혹은
document.onselectstart = new function() {
return false;
}
식으로 쓴다.
3. 참고
function document.onselectstart() {
return false;
}
function document.ondragstart() {
return false;
}