The
no right click code is an aid in attempting to prevent folks from taking
the graphics and source codes on your web site. It is NOT fool proof, there are ways
around it. I like to think of it as a deterrent. Just as with
any other thing, if someone wants it; they will find a way.
The code is below.
CODE
1
This
NO RIGHT CLICK code works ONLY on images! Found at Dynamic
Drive.
Place
this code at the END of your page, just above the </body> tag
<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>
CODE
2
Place
the code in your HTML between </title> and </head>
<script
language="JavaScript"> <!--
//
No rightclick script v.2.5
//
(c) 1998 barts1000
//
barts1000@aol.com
//
Don't delete this header!
var
message="Sorry, that function is disabled. \n\n Contents and Graphics Copyright
StarrVisions.com\n\n Please e-mail for source codes, \n\n Thanks
for visiting."; // Message for the alert box
//
Don't edit below!
function
click(e) {
if
(document.all) {
if
(event.button == 2) {
alert(message);
return
false;
}
}
if
(document.layers) {
if
(e.which == 3) {
alert(message);
return
false;
}
}
}
if
(document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
//
--> </script>
MUSIC
This
code will make music play in both Netscape and Internet Explorer:
This
is great any time you wish to use it, but especially in frame sets!
SCROLLING
MARQUEE
This
is when words scroll from right to left across the page (or left to right
or maybe even down!).
Just
remember that the marquee tag does NOT work with Netscape.
How
to make images change on mouseover.
Add
this code in between the <head> tag and <title> tag
(this
code is for four images, you can alter this code to make more or less images):
<script
language="JavaScript">
<!--
Hide the script from old browsers --
img0_on
= new Image(width,height);
img0_on.src="image2.gif";
img0_off
= new Image(width,height);
img0_off.src="image1.gif";
img1_on
= new Image(width,height);
img1_on.src="image4.gif";
img1_off
= new Image(width,height);
img1_off.src="image3.gif";
img2_on
= new Image(width,height);
img2_on.src="image6.gif";
img2_off
= new Image(width,height);
img2_off.src="image5.gif";
img3_on
= new Image(width,height);
img3_on.src="image8.gif";
img3_off
= new Image(width,height);
img3_off.src="image7.gif";
function
over_image(parm_name)
{
document[parm_name].src = eval(parm_name + "_on.src");
}
function
off_image(parm_name)
{
document[parm_name].src = eval(parm_name + "_off.src");
}
//
--End Hiding Here -->
</script>
Image
1 is the image you want showing all the time.
Image
2 is the image you want to show on mouseover.
Image
3 is permanent.
Image
4 is the mouseover...etc
Remember
to substitute your image filename and width and height attributes.
Next
add this code for every mouseover image you insert in your page, this is
inserted in the body section of your page: