| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
- 리사이즈
- 우분투 npm 설치
- 디지털 정부서비스ui/ux
- JS
- SSL
- 글자 수 제한
- 자바스크립트
- post_type
- iframe
- 구글뷰어
- 날짜변환
- virsualhost
- Ajax
- 301 리다이렉트
- MySQL
- 페이지전환효과
- selinux
- 보안인증서
- 애니메이트
- Vanilla JS
- 우분투
- 정부 서비스 가이드라인
- 정규식
- 글자수제한
- JavaScript
- 날짜비교
- ip직접접근차단
- 배열
- .htaccess
- 비동기호출
- Today
- Total
더 나은 프로그래머가 되자
마우스 우클릭/드래그/선택/키입력 금지 본문
방1)
<script language='javascript' type='text/javascript'>
// 마우스 오른쪽 클릭 방지
document.oncontextmenu = function(e){
alert("no right");
return false;
}
// 마우스 드래그 방지
document.ondragstart = new Function('return false');
// 마우스 선택 방지
document.onselectstart = new Function('return false');
// 키입력 방지
document.onkeydown = new Function('return false');
</script>
방2)
<body>
<script language="JavaScript" type="text/javascript">
var msg="마우스 오른쪽버튼 사용금지";
function disableIE() {if (document.all) {alert(!msg);return false;}
}
function disableNS(e) {
if (document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(!msg);return false;}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
} else {
document.onmouseup=disableNS;document.oncontextmenu=disableIE;
}
document.oncontextmenu=new Function("alert(msg);return false")
</script>
바디와 바디사이에 추가
</body>
'언어 > js' 카테고리의 다른 글
| JQuery 라디오 radio 체크박스 checkbox 컨트롤 (0) | 2012.10.15 |
|---|---|
| 글자 수 제한 스크립트(오버된 글씨는 전체 삭제) (0) | 2012.09.04 |
| 자바스크립트 특수문자 제한 (0) | 2011.11.23 |
| 자바스크립트로 이미지 리사이징하기 (0) | 2011.11.18 |
| 아이프레임(iframe) 사이즈 자동 조절 - 익스,파이어폭스,크롬 (0) | 2011.11.16 |