当前位置:首页 > 对网页的图片进行右键禁止的代码 >
对网页的图片进行右键禁止的代码
2013-10-10 20:36:00 来源:邯郸网站开发
<Script Language="JavaScript1.2">
Var Clickmessage="单独对网页的图片进行右键禁止的代码"
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="Uploadfiles/20123814445851486.Jpg" Onclick="Javascript:window.Open(This.Src);" Style="Cursor:pointer;" Onload="Return Imgzoom(This,600);" Onclick="Javascript:window.Open(This.Src);" Style="Cursor:pointer;"/>