이미지 팝업창에서 오픈쪽버튼 사용금지 적용했는데요 정보
이미지 팝업창에서 오픈쪽버튼 사용금지 적용했는데요본문
수고 많으십니다.
common.js 파일에서 이미지 클릭시 뜨는 팝업창에서 오른쪽버튼 사용금지 소스를 적용시켰는데요..
이미지가 클때 왼쪽마우스클릭후 드래그가 가능했는데, 오른쪽버튼 사용금지 소스 적용후 드래그가 안됩니다. 아시는분 설명 부탁드립니다.
--------- 적용 소스 ------
win=window.open("","image_window",settings);
win.document.open();
win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset="+g4_charset+"'>\n");
var size = "이미지 사이즈 : "+w+" x "+h;
win.document.write ("<title>"+size+"</title> \n");
if(w >= screen.width || h >= screen.height) {
win.document.write (js_url);
var click = "ondblclick='window.close();' style='cursor:move' title=' "+size+" \n\n 이미지 사이즈가 화면보다 큽니다. \n 왼쪽 버튼을 클릭한 후 마우스를 움직여서 보세요. \n\n 더블 클릭하면 닫혀요. '";
}
else
var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n 클릭하면 닫혀요. '";
win.document.write ("<style>.dragme{position:relative;}</style> \n");
win.document.write ("<body leftmargin=0 topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n");
win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img.src+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");
// 팝업창 오른쪽버튼 사용금지 스크립트 추가
win.document.write ("<script type='text/javascript'>\n");
win.document.write ("function checkAlt(){ \n");
win.document.write ("var keyValue = event.keyCode;\n");
win.document.write ("if( keyValue==18 ){\n");
win.document.write ("alert('ALT 키는 사용하실 수 없습니다.');\n");
win.document.write ("return false;\n");
win.document.write ("}\n");
win.document.write ("if( keyValue==17 ){\n");
win.document.write ("alert('CTRL 키는 사용하실 수 없습니다.');\n");
win.document.write ("return false;\n");
win.document.write ("}\n");
win.document.write ("}\n");
win.document.write ("function click(){\n");
win.document.write ("if((event.button==2) || (event.button==3)) {\n");
win.document.write ("alert('오른쪽 버튼은 사용하실 수 없습니다');\n");
win.document.write ("return false;\n");
win.document.write ("}\n");
win.document.write ("}\n");
win.document.write ("document.onkeydown = checkAlt;\n");
win.document.write ("document.onmousedown=click; \n");
win.document.write ("</SCRIPT>");
//팝업창 오른쪽버튼 사용금지 스크립트 끝
win.document.write ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
common.js 파일에서 이미지 클릭시 뜨는 팝업창에서 오른쪽버튼 사용금지 소스를 적용시켰는데요..
이미지가 클때 왼쪽마우스클릭후 드래그가 가능했는데, 오른쪽버튼 사용금지 소스 적용후 드래그가 안됩니다. 아시는분 설명 부탁드립니다.
--------- 적용 소스 ------
win=window.open("","image_window",settings);
win.document.open();
win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset="+g4_charset+"'>\n");
var size = "이미지 사이즈 : "+w+" x "+h;
win.document.write ("<title>"+size+"</title> \n");
if(w >= screen.width || h >= screen.height) {
win.document.write (js_url);
var click = "ondblclick='window.close();' style='cursor:move' title=' "+size+" \n\n 이미지 사이즈가 화면보다 큽니다. \n 왼쪽 버튼을 클릭한 후 마우스를 움직여서 보세요. \n\n 더블 클릭하면 닫혀요. '";
}
else
var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n 클릭하면 닫혀요. '";
win.document.write ("<style>.dragme{position:relative;}</style> \n");
win.document.write ("<body leftmargin=0 topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n");
win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img.src+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");
// 팝업창 오른쪽버튼 사용금지 스크립트 추가
win.document.write ("<script type='text/javascript'>\n");
win.document.write ("function checkAlt(){ \n");
win.document.write ("var keyValue = event.keyCode;\n");
win.document.write ("if( keyValue==18 ){\n");
win.document.write ("alert('ALT 키는 사용하실 수 없습니다.');\n");
win.document.write ("return false;\n");
win.document.write ("}\n");
win.document.write ("if( keyValue==17 ){\n");
win.document.write ("alert('CTRL 키는 사용하실 수 없습니다.');\n");
win.document.write ("return false;\n");
win.document.write ("}\n");
win.document.write ("}\n");
win.document.write ("function click(){\n");
win.document.write ("if((event.button==2) || (event.button==3)) {\n");
win.document.write ("alert('오른쪽 버튼은 사용하실 수 없습니다');\n");
win.document.write ("return false;\n");
win.document.write ("}\n");
win.document.write ("}\n");
win.document.write ("document.onkeydown = checkAlt;\n");
win.document.write ("document.onmousedown=click; \n");
win.document.write ("</SCRIPT>");
//팝업창 오른쪽버튼 사용금지 스크립트 끝
win.document.write ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
댓글 전체
document.onmousedown=selectmouse; 가 실행 되어야 드래그가 되는 것인데
document.onmousedown=click; 해버렸으니 당연히 이미지 이동이 안되지요
저 부분 원위치 시키고 click 함수에 해당하는 부분을 selectmouse 함수 첫 부분에 넣으세요
win.document.write ("if((event.button==2) || (event.button==3)) {\n");
win.document.write ("alert('오른쪽 버튼은 사용하실 수 없습니다');\n");
win.document.write ("return false;\n");
win.document.write ("}\n");
요 부분만 넣으세요
document.onmousedown=click; 해버렸으니 당연히 이미지 이동이 안되지요
저 부분 원위치 시키고 click 함수에 해당하는 부분을 selectmouse 함수 첫 부분에 넣으세요
win.document.write ("if((event.button==2) || (event.button==3)) {\n");
win.document.write ("alert('오른쪽 버튼은 사용하실 수 없습니다');\n");
win.document.write ("return false;\n");
win.document.write ("}\n");
요 부분만 넣으세요
흠... 저는 잘안되는데 소스를 좀 수정해수실 수 없으세요