이미지 팝업창에서 오른쪽버튼 사용금지 적용 방법 문의 정보
이미지 팝업창에서 오른쪽버튼 사용금지 적용 방법 문의
본문
수고 많으십니다.
common.js 파일에서 이미지 클릭시 뜨는 팝업창에서 오른쪽버튼 사용금지 소스를 적용할 수 있는지에 대해 질문 드립니다.
--------- 적용할려는 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 ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
균이님 답변으로는
click 함수에 해당하는 부분을 selectmouse 함수 첫 부분에 넣으세요 ...
win.document.write ("<script type='text/javascript'>\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 ("</SCRIPT>");
요 부분만 넣으세요 ... 여기서 '요 부분만 넣어세요'를 이떻게 넣어라는 말인지 도통 감이 오질 않습니다.
물론 위치를 바꾸어가며 위 함수를 넣어 보았지만 실패했습니다.
도움주시면 감사하겠습니다.
common.js 파일에서 이미지 클릭시 뜨는 팝업창에서 오른쪽버튼 사용금지 소스를 적용할 수 있는지에 대해 질문 드립니다.
--------- 적용할려는 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 ("</body></html>");
win.document.close();
if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}
균이님 답변으로는
click 함수에 해당하는 부분을 selectmouse 함수 첫 부분에 넣으세요 ...
win.document.write ("<script type='text/javascript'>\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 ("</SCRIPT>");
요 부분만 넣으세요 ... 여기서 '요 부분만 넣어세요'를 이떻게 넣어라는 말인지 도통 감이 오질 않습니다.
물론 위치를 바꾸어가며 위 함수를 넣어 보았지만 실패했습니다.
도움주시면 감사하겠습니다.
댓글 전체
win.document.write ("<SCRIPT language=JavaScript>\n");
win.document.write ("function click() {\n");
win.document.write ("if ((event.button==2) || (event.button==2)) {\n");
win.document.write ("alert('이미지무단도용시 법적조치를 받으실 수 있습니다');}\n");
win.document.write ("}document.onmousedown=click\n");
win.document.write ("</SCRIPT>");
이렇게넣으니까 되네요
win.document.write ("function click() {\n");
win.document.write ("if ((event.button==2) || (event.button==2)) {\n");
win.document.write ("alert('이미지무단도용시 법적조치를 받으실 수 있습니다');}\n");
win.document.write ("}document.onmousedown=click\n");
win.document.write ("</SCRIPT>");
이렇게넣으니까 되네요