当前位置:首页 > 网站教程 > 内容列表

企业网站中禁止下载图片的方法及其代码

点击次数:更新时间:2014-05-22 19:05:25【打印】【关闭】

有时候为了保护网站的图片不被其它网站下载使用,可以用代码禁止下载,代码如下:

 

<script language="JavaScript1.2">
/*
Disable right click script II (on images)- By Dynamicdrive.com
For full source, Terms of service, and 100s DTHML scripts
Visit http://www.dynamicdrive.com
*/
var clickmessage="Right click disabled on images!"
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
}
function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}
if (document.all)
document.onmousedown=disableclick
else if (document.layers)
associateimages()
</script>
<img src="#">

空间、网站业务联系QQ:2429256177 邮箱:beescms@163.com
客服

工作时间

周一至周日

8:00 - 18:00

在线客服

点击这里给我发消息 BUG反馈

点击这里给我发消息 网站建设

点击这里给我发消息 域名空间

点击这里给我发消息 授权服务

点击这里给我发消息 售前咨询

点击这里给我发消息 意见反馈

点击这里给我发消息 销售客服

联系手机

18288433386

powerd by BEESCMS