주제: 자바스크립트로 드래그, 우클릭 금지 시...
아래 코드와 같이 자바스크립트로 드래그, 우클릭을 금지시켰는데
input이나 textarea에서도 드래그가 금지 되어버리는데;
input, textarea에서는 드래그를 허용시킬수 있는 방법없을까요?
//<![CDATA[
// 드래그, 우클릭 금지 시키기 //
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false
}
function reEnable(){
return true
}
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else{
document.onmousedown=disableselect
document.onmouseup=reEnable
}
document.oncontextmenu = function() {return false;};
document.onselectstart = function() {return false;};
document.ondragstart = function() {return false;};
// 접었다 폈다 하기 //
function showhide(obj) {
var el = document.getElementById(obj);
if ( el.style.display != 'none' ) {
el.style.display = 'none';
} else {
el.style.display = 'inline';
}
};
//]]>